how to know if socket is still connected

bryanjugglercryptographer at yahoo.com bryanjugglercryptographer at yahoo.com
Wed Jul 19 22:34:13 EDT 2006


Grant Edwards wrote:
> If the server has closed the connection, then a recv() on the
> socket will return an empty string "",

after returning all the data the remote side had sent, of course.

> and a send() on the
> socket will raise an exception.

Send() might, and in many cases should, raise an exception
after the remote side has closed the connection, but the behavior
is unreliable.


-- 
--Bryan




More information about the Python-list mailing list