How to check client shutdown?

Grant Edwards invalid at invalid.invalid
Mon Aug 26 16:24:04 EDT 2013


On 2013-08-26, Paul Pittlerson <menkomigen6 at gmail.com> wrote:

> I'm currently learning about the socket module. My question is how
> can I detect if a connection is closed from the other side,

recv() will return an empty value of ''.

send() will eventually throw an exception.  [You may be able to call
send() once or twice after the connection has been closed without
getting the exception.] On Linux the exception is socket.error with
errno 32 (broken pipe).

-- 
Grant Edwards               grant.b.edwards        Yow! Is this an out-take
                                  at               from the "BRADY BUNCH"?
                              gmail.com            



More information about the Python-list mailing list