sockets: client dies...
Keith Murphy
kpmurphy at my-deja.com
Wed Jan 24 16:18:27 EST 2001
actually, it's set to non-blocking.
::keith
In article <94ksfl$r2a$1 at nntp6.u.washington.edu>,
Donn Cave <donn at u.washington.edu> wrote:
> Quoth Keith Murphy <kpmurphy at my-deja.com>:
> | what can you do when the client dies in a client/server socket
> | relationship? currently, my problem is that the server doesn't know
> | when a client has terminated unexpectedly. is there any way to do
so?
>
> Ideally, that will close the socket. If that happens, then the
> socket becomes "readable" - that is, a recv() will return immediately
> without blocking, returning '' (empty string.) (I'm assuming the
> socket is blocking, per default.)
>
> I don't know any way to tell the difference between "closed" and "has
> data", prior to calling recv(). But you can tell the difference
between
> readable and "would block" prior to recv(), with select().
>
> If the client dies and the socket doesn't close, then it may be worth
> while to figure out why it doesn't.
>
> Donn Cave, donn at u.washington.edu
>
Sent via Deja.com
http://www.deja.com/
More information about the Python-list
mailing list