[New-bugs-announce] [issue13724] socket.create_connection and multiple IP addresses

Mads Kiilerich report at bugs.python.org
Fri Jan 6 23:13:50 CET 2012

New submission from Mads Kiilerich <mads at kiilerich.com>:

Forked from issue13721 where I was too lazy to report it separately:

http://docs.python.org/release/2.7.2/library/socket#socket.create_connection doesn't describe how it loops over all IP addresses. That seems to be the functions main advantage (and a gotcha) compared to creating the socket and connecting directly.

I propose to warn that it might "hang" up to n*timeout before anything happens with something like this in documentation and docstring:

... and return the socket object.
If the host resolves to multiple IP addresses then they will all be tried in turn until one of them succeeds.
Passing the optional timeout parameter will set the timeout on the socket instance before each attempt to connect.
If no ...

assignee: docs at python
components: Documentation
messages: 150772
nosy: docs at python, kiilerix, pitrou
priority: normal
severity: normal
status: open
title: socket.create_connection and multiple IP addresses
type: enhancement
versions: Python 2.7

Python tracker <report at bugs.python.org>

More information about the New-bugs-announce mailing list