Socket.error: [errno 10054] An Existing Connection Was Forcibly Closed By The Remote Host (python2.7)
I have a problem with my socket , it is well functioning but when i close the client / close the client window the server lost the connection ( the server needs to stay open and wa
Solution 1:
When a client does a graceful close of the socket such as client_socket.shutdown(socket.SHUT_WR)
the server will receive all data and then its next recv
call will get 0 bytes. You've coded for this case.
When the client exits without a graceful shutdown, the underlying socket implementation will do an ungraceful termination which includes sending a RESET
to the server. In this case, the server gets the exception you've seen. It means that at the socket level there is no guarantee that the server received all of its data.
You should update your client to be graceful about closing and also decide what your policy should be on ungraceful exit.
Post a Comment for "Socket.error: [errno 10054] An Existing Connection Was Forcibly Closed By The Remote Host (python2.7)"