[Python-Dev] Socket timeout and completion based sockets

Antoine Pitrou solipsis at pitrou.net
Wed Nov 28 17:29:43 CET 2012

Le Wed, 28 Nov 2012 12:13:15 +0000,
Kristján Valur Jónsson <kristjan at ccpgames.com> a écrit :
> I'm sorry, I thought it was something that people did more often, to
> create different implementations of of the "socket" api, for which
> cPython provided a mere reference implementation.  I know of at least
> three different alternative implementations, so I thought that the
> question were clear enough:  Is the timeout mechanism "supposed" to
> be re-startable for an api that aims to conform to the "socket"
> module, or is that a mere coincidence falling out from the select/bsd
> based reference implementation in cPython?

I think recv() and send() (and other simple ops) should certainly be
restartable. sendall() is another matter, I think it should be
considered a best effort thing.

> Anyway, as for concrete requirements:  The issue I have always seen
> with various asynchronous libraries is their lack of composability.

Note: if you are using an asynchronous library, you probably shouldn't
be using any form of socket timeout. Instead, you should be using
timer callbacks as provided by the asynchronous library.
(and the sockets themselves, of course, should be put in non-blocking



More information about the Python-Dev mailing list