how to know if socket is still connected

Grant Edwards grante at visi.com
Mon Jul 17 14:47:30 EDT 2006


On 2006-07-17, nephish at xit.net <nephish at xit.net> wrote:

> hey there, i have a question about this solution.
> if i have a
> message = socket.recv()
> in the script, and the socket connection drops, will the
> socket.recv() just wait forever for something to come across
> the internet port? or will it know if the connection is dropped?

As I said before, if the socket is closed by the remote host,
recv() will return "".

I don't know what you mean by "drops" and "dropped" in this
context.  If you want a useful answer to your question, you'll
have to define your terms precisely.

-- 
Grant Edwards                   grante             Yow!  I'm CONTROLLED by
                                  at               the CIA!! EVERYONE is
                               visi.com            controlled by the CIA!!



More information about the Python-list mailing list