Arduino to Arduino network comms protocol (ethernet)

I have recently done a project where I have 4 ethernet connected arduinos with relays on them (because there is no stable wifi otherwise I would have used the 8266). I am using a RaspberryPi as "management" server with MQTT broker installed.

This however is too complex for the environment I will be deploying it into (issues with SD cards on Pi and really low volume of messages / very small messages) and I want to replace the Pi with another Arduino.

I can however not run the MQTT broker on the Arduino ... what would you suggest with regards to the communication protocols and mechanisms between the manager Arduino and the rest of the Arduinos ... I do not really want to code my own messaging protocol, was hoping there would be some kind of "standard" out there that I am missing. The only "server" I can find that runs on the Arduino is a web server.

The requirement:
The management Arduino is programmed with a schedule (assume that works 100%) and then needs to send "activate" and "deactivate" signals to the remote Arduino units. All units are connected on ethernet.

Please feel free to throw suggestions and vague directions ... not necessary for code samples :wink:

EthernetClient object wraps a TCP socket. A normal TCP socket is connected to IP address and port. EthernetServer starts a listening socket on a port. If server on listening socket is contacted by a remote client socket, it creates a local socket connected with the remote client socket on a free port and returns a EthernetClient object wrapping the socket. Everything you write or print to a EthernetClient is send to that one remote socket.

If one of your client boards creates a EthernetClient and connects it to IP address and port of the EthernetServer on your 'server' board, then you get there a EthernetClient from server.available() and this two EthernetClient objects are connected. What you write/print on one side you read only from the EthernetClient object on the other side.

client socket

   if (client.connect(serverIP, PORT)) {
     client.print("request\n");
     String response = client.readStringUntil('\n');
     Serial.println(response);
     client.stop();
   }

server side

   EthernetClient client = server.available();
   if (client && client.connected()) {
     String request = client.readStringUntil('\n');
     Serial.println(request);
     client.print("response\n");
     client.stop();
   }

Hi @Tesla Member, this looks easy enough ... less overhead on the Arduino than running a full web server. Thank you, I will give it a try.

johandb:
Hi @Tesla Member, this looks easy enough ... less overhead on the Arduino than running a full web server. Thank you, I will give it a try.

@Newbie, that is a rank.
see the examples of the Ethernet library

Oops ... :blush: