summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>2018-07-28 12:27:27 (GMT)
committerGitHub <noreply@github.com>2018-07-28 12:27:27 (GMT)
commit30f295b85ece2dc2b2b65018bd15090efa1de7dc (patch)
tree62516475740d4fd9c18604748f269999cba67f4a
parent0041d721a6f6b312ef762838d390fc4d64cf5e3a (diff)
downloadcpython-30f295b85ece2dc2b2b65018bd15090efa1de7dc.zip
cpython-30f295b85ece2dc2b2b65018bd15090efa1de7dc.tar.gz
cpython-30f295b85ece2dc2b2b65018bd15090efa1de7dc.tar.bz2
bpo-33921: Clarify how to bind to all interfaces using socket (GH-7877)
Clarify how to bind to all interfaces using socket (cherry picked from commit 95dfb9c3aefdc981d23af700b753a6c97159ccad) Co-authored-by: johnthagen <johnthagen@users.noreply.github.com>
-rw-r--r--Doc/library/socket.rst13
1 files changed, 7 insertions, 6 deletions
diff --git a/Doc/library/socket.rst b/Doc/library/socket.rst
index 512c38e..974df4c 100644
--- a/Doc/library/socket.rst
+++ b/Doc/library/socket.rst
@@ -70,6 +70,13 @@ created. Socket addresses are represented as follows:
notation like ``'daring.cwi.nl'`` or an IPv4 address like ``'100.50.200.5'``,
and *port* is an integer.
+ - For IPv4 addresses, two special forms are accepted instead of a host
+ address: ``''`` represents :const:`INADDR_ANY`, which is used to bind to all
+ interfaces, and the string ``'<broadcast>'`` represents
+ :const:`INADDR_BROADCAST`. This behavior is not compatible with IPv6,
+ therefore, you may want to avoid these if you intend to support IPv6 with your
+ Python programs.
+
- For :const:`AF_INET6` address family, a four-tuple ``(host, port, flowinfo,
scopeid)`` is used, where *flowinfo* and *scopeid* represent the ``sin6_flowinfo``
and ``sin6_scope_id`` members in :const:`struct sockaddr_in6` in C. For
@@ -154,12 +161,6 @@ created. Socket addresses are represented as follows:
.. XXX document them!
-For IPv4 addresses, two special forms are accepted instead of a host address:
-the empty string represents :const:`INADDR_ANY`, and the string
-``'<broadcast>'`` represents :const:`INADDR_BROADCAST`. This behavior is not
-compatible with IPv6, therefore, you may want to avoid these if you intend
-to support IPv6 with your Python programs.
-
If you use a hostname in the *host* portion of IPv4/v6 socket address, the
program may show a nondeterministic behavior, as Python uses the first address
returned from the DNS resolution. The socket address will be resolved