Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: EthernetInterface SimpleSocket mbed-rtos mbed
udpreceiver.cpp
00001 #include "SimpleSocket.h" 00002 00003 void udpreceiver() { 00004 DatagramSocket datagram(7777); 00005 datagram.setTimeout(1.0); 00006 Endpoint buddy; 00007 while (true) { 00008 if (datagram.receive(buddy) > 0) { 00009 char *ip = buddy.get_address(); 00010 int port = buddy.get_port(); 00011 char buf[80] = {}; 00012 int len = datagram.read(buf, sizeof(buf) - 1); 00013 printf("received from %s:%d %s", ip, port, buf); 00014 } 00015 } 00016 }
Generated on Mon Jul 18 2022 00:17:10 by
1.7.2