Skip to content

Commit

Permalink
bpo-45693: Document port parameter to loop.create_server (pythonG…
Browse files Browse the repository at this point in the history
…H-29760)

Document the `port` parameter to `loop.create_server` in `asyncio`. In
particular, note that if `host` resolves to multiple network interfaces,
passing in `port=0` will result in a different random unused port being
used for each interface.

Automerge-Triggered-By: GH:ericvsmith
  • Loading branch information
jcrist authored and remykarem committed Dec 7, 2021
1 parent dcaa3ae commit 8b5e533
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions Doc/library/asyncio-eventloop.rst
Original file line number Diff line number Diff line change
Expand Up @@ -631,6 +631,11 @@ Creating network servers
assumed and a list of multiple sockets will be returned (most likely
one for IPv4 and another one for IPv6).

* The *port* parameter can be set to specify which port the server should
listen on. If ``0`` or ``None`` (the default), a random unused port will
be selected (note that if *host* resolves to multiple network interfaces,
a different random port will be selected for each interface).

* *family* can be set to either :data:`socket.AF_INET` or
:data:`~socket.AF_INET6` to force the socket to use IPv4 or IPv6.
If not set, the *family* will be determined from host name
Expand Down

0 comments on commit 8b5e533

Please sign in to comment.