Emilio Monti
/
BroadcastSend
Example message broadcasting
Revision 0:e18c3e98ed3d, committed 2013-03-01
- Comitter:
- emilmont
- Date:
- Fri Mar 01 16:25:32 2013 +0000
- Commit message:
- first commit
Changed in this revision
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/EthernetInterface.lib Fri Mar 01 16:25:32 2013 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/mbed_official/code/EthernetInterface/#9b2d10dc0392
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Fri Mar 01 16:25:32 2013 +0000 @@ -0,0 +1,25 @@ +#include "mbed.h" +#include "EthernetInterface.h" + +const int BROADCAST_PORT = 58083; + +int main() { + EthernetInterface eth; + eth.init(); //Use DHCP + eth.connect(); + + UDPSocket sock; + sock.init(); + sock.set_broadcasting(); + + Endpoint broadcast; + broadcast.set_address("255.255.255.255", BROADCAST_PORT); + + char out_buffer[] = "very important data"; + + while (true) { + printf("Broadcasting...\n"); + sock.sendTo(broadcast, out_buffer, sizeof(out_buffer)); + Thread::wait(1000); + } +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed-rtos.lib Fri Mar 01 16:25:32 2013 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/mbed_official/code/mbed-rtos/#53e6cccd8782
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Fri Mar 01 16:25:32 2013 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/mbed_official/code/mbed/builds/3d0ef94e36ec \ No newline at end of file