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: EthernetNetIf SimpleSocket 1.0 mbed
echoserver.cpp
- Committer:
- yamaguch
- Date:
- 2011-11-02
- Revision:
- 33:39d9cdf99de8
- Parent:
- 26:6f42de9d8ed8
File content as of revision 33:39d9cdf99de8:
#include "EthernetNetIf.h" #include "SimpleSocket.h" void echoserver() { EthernetNetIf eth; eth.setup(); ServerSocket server(1234); while (true) { ClientSocket socket = server.accept(); if (socket) { while (socket) { char buf[80]; int len = socket.read(buf, sizeof(buf)); if (len > 0) socket.write(buf, len); } socket.close(); } } }