How to tell when a socket is closed on the other end?

billiejoex gnewsg at gmail.com
Wed Jul 25 09:57:43 EDT 2007


Hi there.
I'm setting up test suite for a project of mine.
>From test suite, acting as a client, I'd like to know, in certain
situations, if the socket is closed on the other end or not.
I noticed that I can "detect" such state if a call to socket.read()
returns 0 but it seems a little poor to me. :-\
Is there a reliable way to test such socket 'state'?




More information about the Python-list mailing list