ArduSimpSrv explores a compact command protocol over Ethernet. A client sends two command bytes and the Arduino returns a short binary response, controls an LED or reports an analog reading. It is a useful comparison with the HTTP/aREST examples elsewhere in this collection.
How the project works
The server listens on TCP port 5202 using the Ethernet library and a static network configuration. Recognized command pairs include 50 AF for LED off, 51 AE for LED on and 71 8E for an analog read from A1.
Other handlers return version information, an accepted-command counter and a fixed test response. Some replies contain a simple XOR of data bytes. The optional sounder beeps after recognized commands; that call blocks briefly while the tone output is active.
Hardware and configuration
| Item | In the supplied code |
|---|---|
| Transport | Binary TCP on port 5202 |
| LED / sounder | D8 / D7 |
| Analog input | A1 |
| Serial diagnostics | 9600 baud |
50 AF → LED off
51 AE → LED on
71 8E → read A1
7E 81 → version
7F 80 → command counter
BB 82 → test response
Working with the supplied code
Use a client capable of sending raw bytes. Typing 51AE into a web browser is not equivalent to sending bytes 0x51 and 0xAE to the socket. The source comments reference a companion client from Sheepdog Guides.
Before extending the server, add buffering that waits for both command bytes. The saved loop reads twice after checking the connection, without first ensuring that two bytes are available. Review response lengths against the 68-byte buffer, and configure a unique network address for the board.
Source code and project files
Browse this project on GitHub. The files below are useful starting points for the sketches and references discussed in this post.
Download the used libraries (ZIP, 14.7 MB).
The source is the public-domain TCP005 example from Sheepdog Guides, preserved with its original explanatory comments.
These notes describe the archived source and project media. The sketches have not been rebuilt or tested on hardware for this article.


