sockets: client dies...

Cary O'Brien cobrien at Radix.Net
Sat Jan 27 08:27:09 EST 2001


In article <94pn5h$t3e$1 at nntp6.u.washington.edu>,
Donn Cave  <donn at u.washington.edu> wrote:
>Quoth Keith Murphy <kpmurphy at my-deja.com>:
>| ok here's what i understand.

[snip discussion of socket programming approaches]

>
>To reiterate:  When the client dies, the connection will close.
>When the connection has closed, recv() will return an empty string,
>length == 0.
>

Depends on what you mean by dies.  If the process at the other end
terminates and the operating system thereunder operates correctly,
you're right, the TCP session will close and recv() will return
an empty string.

But if you're talking to a PC, and they just shut it off, or the DSL
line goes down or someone picks up the phone on the modem line or
something your end won't know that for a *LONG* time.  So your recv()
may hang.

Just thought I'd bring that up.

[snip ditto]

reliving-painfull-episodes-of-past-jobs-ly yours




More information about the Python-list mailing list