Here is the code as is when printing the received message one character at a time.
The message prints correctly.
Message sent is in this format:
<###,###,###>
example message:
<255,255,255>
I am adding the '<' and '>' to identify the start and end of messages.
This is not required and can be modified if needed.
#include <Ethernet.h>
byte mac[] = {0x54, 0x52, 0x49, 0x41, 0x44, 0x00};
byte ip[] = {192, 168, 2, 99};
byte gateway[] = {192, 168, 0, 1};
byte subnet[] = {255, 255, 0, 0};
EthernetServer server(4444);
EthernetClient client;
int sizeMessage = 11;
void setup() {
Serial.begin(9600);
Ethernet.begin(mac, ip, gateway, subnet);
server.begin();
client = server.available();
}
void loop() {
char inByte;
char message[sizeMessage];
int bytes;
while(!client){
client = server.available();
}
if (client.available()) {
char c = client.read();
Serial.print(c);
}
}