socket question
brueckd at tbye.com
brueckd at tbye.com
Mon Jan 7 16:35:10 EST 2002
On Mon, 7 Jan 2002, Adonis Vargas wrote:
> how do i check if a client is still connected to my socket server?
Hi Adonis,
Assuming you're using TCP sockets:
- If you call the socket's recv() method and you get an empty string, the
client has finished.
- If you call the socket's send() method and you get a socket.error
exception such as (32, 'Broken pipe'), the client has finished. Note that
you might not get an exception raised on the very first byte you send out
as in some cases output will be buffered.
-Dave
More information about the Python-list
mailing list