I used the Arduino Ethernet library WebServer example as a template to create a server on my W5500-EVB-Pico board. The data successfully shows up in raw terminals on the receiving PC, but the data cannot be read by a Python socket.
ON THE ARDUINO-ETHERNET SERVER END: I modified the loop() block to simply send some numbers as a sanity check, and I removed the http part (so it's just a raw stream of data):
void loop() {
EthernetClient client = server.available();
if(!client) {
Serial.println("ERROR: no client");
delay(5000);
}
if(client && client.connected() && client.available()) {
Serial.println("*********new client*********");
for(int j = 0; j < 10; j++) {
client.write(j * 6);
}
} else {
Serial.println("failed to connect...");
}
}
ON THE RECEIVING PC END: I wrote a simple Python script, and created a socket client to receive the data:
import socket
# Replace these values with the actual IP address and port of your server
server_ip = "140.102.1.33"
server_port = 5000
# Create a socket object
client_socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
while True:
client_socket.connect((server_ip, server_port))
msg = client_socket.recv(1024)
print(msg.decode())
I know with certainty that the data is getting to the receiving PC, because I could see it show up in both PuTTY and TeraTerm.