Mailing List Archive

bpo-45693: Document `port` parameter to `loop.create_server` (GH-29760) (GH-29762)
https://github.com/python/cpython/commit/8cabcde8d66bfd8abc98b862c93c66946f8514a1
commit: 8cabcde8d66bfd8abc98b862c93c66946f8514a1
branch: 3.10
author: Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
committer: ericvsmith <ericvsmith@users.noreply.github.com>
date: 2021-11-24T15:39:51-05:00
summary:

bpo-45693: Document `port` parameter to `loop.create_server` (GH-29760) (GH-29762)

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
(cherry picked from commit d71c7bc7339eb82de493c66ebbbfa1cad250ac78)

Co-authored-by: Jim Crist-Harif <jcristharif@gmail.com>

Co-authored-by: Jim Crist-Harif <jcristharif@gmail.com>

files:
M Doc/library/asyncio-eventloop.rst

diff --git a/Doc/library/asyncio-eventloop.rst b/Doc/library/asyncio-eventloop.rst
index eee8095bd4c0f..44798dc3e23cb 100644
--- a/Doc/library/asyncio-eventloop.rst
+++ b/Doc/library/asyncio-eventloop.rst
@@ -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

_______________________________________________
Python-checkins mailing list
Python-checkins@python.org
https://mail.python.org/mailman/listinfo/python-checkins