On 2006-07-17, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:

> oh, sorry, what i mean by dropped is that the server i am
> connecting to can close the connection.

Then recv() will return "" and send() will raise an exception.

> If that happens, i need to know about it. i also need to know
> about it if the server i am connecting to just dies.

Again, you have to define what you mean by "server just dies".

If the server _application_ crashes or exits, then the OS will
close the socket and recv() will return "".  If somebody powers
down the server without warning, or if the server OS crashes,
or if the Ethernet cable between the Internet and the server is
cut, then the socket will not be closed, and recv() will wait
forever[1].

> if recv() returns "" is that the same as NONE ?

No.  It's the empty string (also spelt '').

> I mean can the value be tested true or false?

Yes.  The empty string is false, all non-empty strings are
true.

[1] Unless you've enabled the TCP Keepalive feature, in which
    case the socket will timeout in a couple hours and recv()
    will return "".

-- 
Grant Edwards                   grante             Yow!  Now I am depressed...
                                  at               
                               visi.com            
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to