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 95dfb9c3ae)

Co-authored-by: johnthagen <johnthagen@users.noreply.github.com>
This commit is contained in:
Miss Islington (bot) 2018-07-28 05:27:15 -07:00 committed by GitHub
parent c6801b48a1
commit 2335544562
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 7 additions and 6 deletions

View File

@ -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'``, notation like ``'daring.cwi.nl'`` or an IPv4 address like ``'100.50.200.5'``,
and *port* is an integer. 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, - For :const:`AF_INET6` address family, a four-tuple ``(host, port, flowinfo,
scopeid)`` is used, where *flowinfo* and *scopeid* represent the ``sin6_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 and ``sin6_scope_id`` members in :const:`struct sockaddr_in6` in C. For
@ -171,12 +178,6 @@ created. Socket addresses are represented as follows:
.. XXX document them! .. 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 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 program may show a nondeterministic behavior, as Python uses the first address
returned from the DNS resolution. The socket address will be resolved returned from the DNS resolution. The socket address will be resolved