Re: send with timeout socket

2006-09-22 Thread Bryan Olson
Stéphane Ninin wrote: > I want to make sure that, if nothing is sent after some time, > if event "terminated" is set, > then the thread doesnot spend more time trying to send something which > has become useless. You should be good then. The timeout is on each send(), and send times out if and o

Re: send with timeout socket

2006-09-22 Thread Bryan Olson
Stéphane Ninin wrote: > Yes, I typed it *really* too fast, it would be more something like this: > > def sendall(self, data): > while data: > try: > n = self.request.send(data) > data = data[n:] > except socket.timeout, e: >

Re: send with timeout socket

2006-09-22 Thread Bryan Olson
Stéphane Ninin wrote: > I have a few questions regarding sockets with timeouts. > > Assuming you set a timeout t on a socket s and then call: > > > 1) s.sendall > Is the socket.timeout exception thrown when > not the data was sent in the given time t > or if nothing was sent ? Neither; not exa

Re: send with timeout socket

2006-09-22 Thread Steve Holden
Stéphane Ninin wrote: > Hello, > > I have a few questions regarding sockets with timeouts. > > Assuming you set a timeout t on a socket s and then call: > > > 1) s.sendall > Is the socket.timeout exception thrown when > not the data was sent in the given time t > or if nothing was sent ? >