Grant Edwards wrote:
> Laszlo Nagy wrote:
>> What about non-blocking sockets?
>
> $ man recv
> ...
>If no messages are available at the socket, the receive
>calls wait for a message to arrive, unless the socket is
>non-blocking (see fcntl(2)), in which case the value -1
>
On Mar 28, 10:01 am, Jason Kristoff wrote:
> I'm trying to make something that once it is disconnected will
> automatically try to reconnect. I'll add some more features in later so
> it doesn't hammer the server but right now I just want to keep it simple
> and get that part working. The proble
On 2008-03-28, Laszlo Nagy <[EMAIL PROTECTED]> wrote:
>
>> Yes, that is exactly what it means.
>>
>> >From the recv() man page:
>>
>> RETURN VALUE
>>These calls return the number of bytes received, or -1 if an
>> error
>>occurred. The return value will be 0 when the peer has
> Yes, that is exactly what it means.
>
> >From the recv() man page:
>
> RETURN VALUE
>These calls return the number of bytes received, or -1 if an error
>occurred. The return value will be 0 when the peer has performed an
>orderly shutdown.
>
>
Mea cupla. :-)
W
On 2008-03-28, Laszlo Nagy <[EMAIL PROTECTED]> wrote:
>> while (1):
>> buffer = sock.recv(1024)
>> if not buffer:
>> dodiscon()
>>
>
> sock.recv(1024) can return zero bytes of data indicating that no data
> arrived yet.
No, it can't.
> It does not mean that you have been d
> This is what I've got right now:
>
> #! /usr/bin/env python
> import socket, string
> sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
> def doconn():
> sock.connect(("localhost", 1234))
> def dodiscon():
> sock.close()
> doconn()
>
> doconn()
>
> while (1):
> buffer
Did you try just creating a new socket every time you do a connect ?
On Mar 28, 10:01 am, Jason Kristoff wrote:
> I'm trying to make something that once it is disconnected will
> automatically try to reconnect. I'll add some more features in later so
> it doesn't hammer the server but right now
I'm trying to make something that once it is disconnected will
automatically try to reconnect. I'll add some more features in later so
it doesn't hammer the server but right now I just want to keep it simple
and get that part working. The problem is that when I use sock.close I
get an error m