summaryrefslogtreecommitdiffstats
path: root/Doc/library/socket.rst
diff options
context:
space:
mode:
authorGregory P. Smith <greg@mad-scientist.com>2010-01-03 03:28:29 (GMT)
committerGregory P. Smith <greg@mad-scientist.com>2010-01-03 03:28:29 (GMT)
commitb4066374db45af2927eb5cde68f9b030eaec1b96 (patch)
tree1c09a2cc471c099ab2e1cbd8d4d29d30a38b3276 /Doc/library/socket.rst
parent91ae4a1404fabc236a835cd5dd058f7e6b32062b (diff)
downloadcpython-b4066374db45af2927eb5cde68f9b030eaec1b96.zip
cpython-b4066374db45af2927eb5cde68f9b030eaec1b96.tar.gz
cpython-b4066374db45af2927eb5cde68f9b030eaec1b96.tar.bz2
Merged revisions 77263-77264 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk ........ r77263 | gregory.p.smith | 2010-01-02 17:29:44 -0800 (Sat, 02 Jan 2010) | 4 lines Adds an optional source_address parameter to socket.create_connection(). For use by issue3972. ........ r77264 | gregory.p.smith | 2010-01-02 18:06:07 -0800 (Sat, 02 Jan 2010) | 5 lines issue3972: HTTPConnection and HTTPSConnection now support a source_address parameter. Also cleans up an annotation in the socket documentation. ........
Diffstat (limited to 'Doc/library/socket.rst')
-rw-r--r--Doc/library/socket.rst9
1 files changed, 8 insertions, 1 deletions
diff --git a/Doc/library/socket.rst b/Doc/library/socket.rst
index 79a4964..ec8ff3d 100644
--- a/Doc/library/socket.rst
+++ b/Doc/library/socket.rst
@@ -194,7 +194,7 @@ The module :mod:`socket` exports the following constants and functions:
this platform.
-.. function:: create_connection(address[, timeout])
+.. function:: create_connection(address[, timeout[, source_address]])
Convenience function. Connect to *address* (a 2-tuple ``(host, port)``),
and return the socket object. Passing the optional *timeout* parameter will
@@ -202,6 +202,13 @@ The module :mod:`socket` exports the following constants and functions:
*timeout* is supplied, the global default timeout setting returned by
:func:`getdefaulttimeout` is used.
+ If supplied, *source_address* must be a 2-tuple ``(host, port)`` for the
+ socket to bind to as its source address before connecting. If host or port
+ are '' or 0 respectively the OS default behavior will be used.
+
+ .. versionchanged:: 3.2
+ *source_address* was added.
+
.. function:: getaddrinfo(host, port[, family[, socktype[, proto[, flags]]]])