pystalkd icon indicating copy to clipboard operation
pystalkd copied to clipboard

Socket error causes ValueError

Open evgenybf opened this issue 2 years ago • 0 comments

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:

image

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.

evgenybf avatar Jul 07 '22 11:07 evgenybf