Does anybody has a good TCP client example working? I’ve been using the Berkeley Socket API found in
./ioLibrary/Ethernet/socket.c but sometimes it behaves strangely. I have to insert some delay between functions. Sometimes works fine but not others. I’ve been analyzing the return value but does not help.
I have to insert some delays between creating the socket, open the connection and send or receive data:
sn=0 // using only the socket 0 socket(sn, Sn_MR_TCP, port_server, 0); delay(100); connect(sn, destip, destport) delay(100); send(sn, buf+sentsize, size-sentsize);
I also realized that depending the server location i have to change the delay time. The further away the server (ex. on Amazon) the higher are the changes to get errors. If i test in a local machine it works most of time.