Python Client Disconnect If Server Closes Connection
I have server and client code in python in which client sends a request message to server and wait for the response. I have the server code to close the connection when the client
Solution 1:
When you have a loop with recv
or anything that reads from a socket or a pipe, you should stop reading as soon as you get a buffer with len 0 :
while True:
data=the_socket.recv(8192)
if len(data) == 0: break
...
Post a Comment for "Python Client Disconnect If Server Closes Connection"