Q:

TCP Server receiving from client doesn't work sometimes

I'm working on a server written in Python for my own protocol, but I'm having an issue.
The client connects to the server, and sendall()'s three pieces of data: a packet identification byte, a string length, and a UTF-8 encoding string.
On the client side, I get no errors, but on the server side, this:
error: [Errno 10054] An existing connection was forcibly closed by the remote host

occurs. The error happens at different lines every time, sometimes when recv()ing the identification byte, sometimes when reading the string length, sometimes when reading the string itself, and sometimes it works perfectly fine, just as it is supposed to.
What is going on here? The server computer has a firewall exception. The client connects, sends three pieces of data in succession, then closes the socket. Am I doing this too fast?
Thanks. 

A:

Well, this wasn't a long-lived question.
It looks like I was closing the socket client-side too fast, after adding a limit, I stopped getting the error.
Thanks!

