]> git.gir.st - tmk_keyboard.git/blob - tool/mbed/mbed-sdk/libraries/tests/net/helloworld/multicast_send/main.cpp
Squashed 'tmk_core/' changes from 7967731..b9e0ea0
[tmk_keyboard.git] / tool / mbed / mbed-sdk / libraries / tests / net / helloworld / multicast_send / main.cpp
1 #include "mbed.h"
2 #include "EthernetInterface.h"
3
4 const char* MCAST_GRP = "224.1.1.1";
5 const int MCAST_PORT = 5007;
6
7 int main() {
8 EthernetInterface eth;
9 eth.init(); //Use DHCP
10 eth.connect();
11
12 UDPSocket sock;
13 sock.init();
14
15 Endpoint multicast_group;
16 multicast_group.set_address(MCAST_GRP, MCAST_PORT);
17
18 char out_buffer[] = "very important data";
19 while (true) {
20 printf("Multicast to group: %s\n", MCAST_GRP);
21 sock.sendTo(multicast_group, out_buffer, sizeof(out_buffer));
22 Thread::wait(1000);
23 }
24 }
Imprint / Impressum