Skip to content

Commit d71c7bc

Browse files
authored
bpo-45693: Document port parameter to loop.create_server (GH-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
1 parent 256f9c4 commit d71c7bc

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
@@ -631,6 +631,11 @@ Creating network servers
631631
assumed and a list of multiple sockets will be returned (most likely
632632
one for IPv4 and another one for IPv6).
633633

634+
* The *port* parameter can be set to specify which port the server should
635+
listen on. If ``0`` or ``None`` (the default), a random unused port will
636+
be selected (note that if *host* resolves to multiple network interfaces,
637+
a different random port will be selected for each interface).
638+
634639
* *family* can be set to either :data:`socket.AF_INET` or
635640
:data:`~socket.AF_INET6` to force the socket to use IPv4 or IPv6.
636641
If not set, the *family* will be determined from host name

0 commit comments

Comments
 (0)