how to know if socket is still connected

nephish at xit.net nephish at xit.net
Mon Jul 17 14:57:51 EDT 2006


oh, sorry, what i mean by dropped is that the server i am connecting to
can close the connection. 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.

if recv() returns "" is that the same as NONE ?
again, sorry, i am still kinda new at this.
I mean can the value be tested true or false?

thanks
-sk


Grant Edwards wrote:
> 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