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
echoserver.cpp
00001 #include "SimpleSocket.h" 00002 00003 void echoserver() 00004 { 00005 ServerSocket server(1234); 00006 00007 printf("server: %s:1234\n", EthernetInterface::getIPAddress()); 00008 00009 while (true) { 00010 ClientSocket socket = server.accept(); 00011 00012 if (socket) { 00013 while (socket) { 00014 char buf[80]; 00015 int len = socket.read(buf, sizeof(buf)); 00016 if (len > 0) 00017 socket.write(buf, len); 00018 } 00019 socket.close(); 00020 } 00021 wait(1.0); 00022 } 00023 }
Generated on Mon Jul 18 2022 00:17:10 by
1.7.2