pystalkd
pystalkd copied to clipboard
Socket error causes ValueError
recv()
returns empty byte string when connection is lost (it's by design) and never generates socket.error
. As a result, when connection is broken, SocketError.wrap()
is not able to catch it and send()
method fails with ValueError
:
See also: https://docs.python.org/2/howto/sockets.html
When a recv returns 0 bytes, it means the other side has closed (or is in the process of closing) the connection. You will not receive any more data on this connection. Ever. You may be able to send data successfully; I’ll talk more about this later.