Skip to content

Commit 151c9bf

Browse files
bpo-45693: Document port parameter to loop.create_server (GH-29760) (GH-29763)
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 d71c7bc) Co-authored-by: Jim Crist-Harif <[email protected]> Co-authored-by: Jim Crist-Harif <[email protected]>
1 parent 455ed45 commit 151c9bf

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

Doc/library/asyncio-eventloop.rst

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -626,6 +626,11 @@ Creating network servers
626626
assumed and a list of multiple sockets will be returned (most likely
627627
one for IPv4 and another one for IPv6).
628628

629+
* The *port* parameter can be set to specify which port the server should
630+
listen on. If ``0`` or ``None`` (the default), a random unused port will
631+
be selected (note that if *host* resolves to multiple network interfaces,
632+
a different random port will be selected for each interface).
633+
629634
* *family* can be set to either :data:`socket.AF_INET` or
630635
:data:`~socket.AF_INET6` to force the socket to use IPv4 or IPv6.
631636
If not set, the *family* will be determined from host name

0 commit comments

Comments
 (0)