[Python-Dev] Adding timeout to socket.py and httplib.py

Facundo Batista facundo at taniquetil.com.ar
Tue Mar 20 17:55:20 CET 2007


Alan Kennedy wrote:

> Sorry, my mistake.

No problem.


> So, a question I would ask is: Is "connect" the right name for that function?
> ...
> Perhaps a better name might be "create_connected_client_socket", or
> something equally descriptive?

Guido proposed "connect_with_timeout". I don't like your proposal,
neither Guido's.

But, I recognize that maybe it's not the best name. What about
"create_connection"?


> Another question I would ask is: "How do I ensure that my newly
> created connected client socket is in blocking mode, *without* making
> any assumptions about the value of socket.getdefaulttimeout()?"

Call like this:

  newsock = socket.connect((..., ...))
  newsock.setblocking(1)

Remember that this function is to replace the same code in N other
places, and in any of other places I saw this usage.

Regards,

-- 
.   Facundo
.
Blog: http://www.taniquetil.com.ar/plog/
PyAr: http://www.python.org/ar/




More information about the Python-Dev mailing list