how to know if socket is still connected

Steve Holden steve at holdenweb.com
Thu Jul 20 05:36:19 EDT 2006


Lawrence D'Oliveiro wrote:
> In message <12blgl1t9egsqb8 at corp.supernews.com>, Grant Edwards wrote:
> 
> 
>>If the server has closed the connection, then a recv() on the
>>socket will return an empty string "", and a send() on the
>>socket will raise an exception.
> 
> 
> Would that still apply when trying to send an empty string?

Yes: sending an empty string demands no action on the server's part, as 
the receiver has already received it ... adding an empty string to 
whatever the sender currently has buffered does not require any state 
change on the sender's part.

regards
  Steve
-- 
Steve Holden       +44 150 684 7255  +1 800 494 3119
Holden Web LLC/Ltd          http://www.holdenweb.com
Skype: holdenweb       http://holdenweb.blogspot.com
Recent Ramblings     http://del.icio.us/steve.holden




More information about the Python-list mailing list