Regarding the recent discussion on python-ideas about asyncronous IO, I'd like 
to ask a question about python socket's Timeout feature.
Specifically this:  Is it a documented or a guaranteed feature that a 
send/receive operation that times out with a socket.timeout error is 
re-startable on that socket?

The reason I ask is that depending on the implementation, a timeout may leave a 
socket in an undefined state.
As it is implemented in the standard cPython implementation, the timeout 
feature is done with an internal select() call.  Thus, if the select() call 
times out, socket send/receive is not even called, so a retry is possible 
without issue.
However, other implementations of python sockets, e.g. ones that rely on IO 
completion, may not have the luxury of using select.  For example, on Windows, 
there is no way to abort an IOCP socket call, so a timeout must be implemented 
by aborting the wait.  Dealing with the resulting race can be an interesting 
challenge.

K
_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to