send with timeout socket

Bryan Olson fakeaddress at nowhere.org
Fri Sep 22 10:52:19 EDT 2006


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 exactly anyway. It may call send() several
times, and it raises socket.timeout if any of the calls
blocks for longer than the socket's timeout.


> 2) Similar question for s.send:
> Is the socket.timeout exception thrown when 
> nothing was sent or ... ?

Raised when and only when nothing was sent.


-- 
--Bryan



More information about the Python-list mailing list