SocketGUS

Fork of Socket by mbed official

Files at this revision

API Documentation at this revision

Comitter:
emilmont
Date:
Thu May 30 17:15:01 2013 +0100
Parent:
17:c5089d058eab
Child:
19:434906b5b977
Commit message:
enable/disable broadcasting

Changed in this revision

UDPSocket.cpp Show annotated file Show diff for this revision Revisions of this file
UDPSocket.h Show annotated file Show diff for this revision Revisions of this file
--- a/UDPSocket.cpp	Tue May 14 09:48:07 2013 +0000
+++ b/UDPSocket.cpp	Thu May 30 17:15:01 2013 +0100
@@ -59,8 +59,8 @@
     return set_option(IPPROTO_IP, IP_ADD_MEMBERSHIP, &mreq, sizeof(mreq));
 }
 
-int UDPSocket::set_broadcasting(void) {
-    int option = 1;
+int UDPSocket::set_broadcasting(bool broadcast) {
+    int option = (broadcast) ? (1) : (0);
     return set_option(SOL_SOCKET, SO_BROADCAST, &option, sizeof(option));
 }
 
--- a/UDPSocket.h	Tue May 14 09:48:07 2013 +0000
+++ b/UDPSocket.h	Thu May 30 17:15:01 2013 +0100
@@ -54,7 +54,7 @@
     /** Set the socket in broadcasting mode
     \return 0 on success, -1 on failure.
     */
-    int set_broadcasting(void);
+    int set_broadcasting(bool broadcast=true);
     
     /** Send a packet to a remote endpoint
     \param remote   The remote endpoint