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 mbed-rtos mbed
Fork of UDPEchoServer by
Revision 6:bd7f46b6fa23, committed 2015-05-05
- Comitter:
- mbedAustin
- Date:
- Tue May 05 20:08:42 2015 +0000
- Parent:
- 5:76845960c8a2
- Commit message:
- added more verbose output for terminal
Changed in this revision
| main.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/main.cpp Wed May 14 15:35:17 2014 +0000
+++ b/main.cpp Tue May 05 20:08:42 2015 +0000
@@ -7,7 +7,7 @@
EthernetInterface eth;
eth.init(); //Use DHCP
eth.connect();
- printf("IP Address is %s\n", eth.getIPAddress());
+ printf("\nServer IP Address is %s\n", eth.getIPAddress());
UDPSocket server;
server.bind(ECHO_SERVER_PORT);
@@ -15,10 +15,13 @@
Endpoint client;
char buffer[256];
while (true) {
- printf("\nWait for packet...\n");
+ printf("\nWaiting for UDP packet...\n");
int n = server.receiveFrom(client, buffer, sizeof(buffer));
+ buffer[n] = '\0';
printf("Received packet from: %s\n", client.get_address());
+ printf("Packet contents : '%s'\n",buffer);
+ printf("Sending Packet back to Client\n");
server.sendTo(client, buffer, n);
}
}
