[Python-checkins] bpo-45351, asyncio: Enhance echo server example, print all addresses (GH-28828)
miss-islington
webhook-mailer at python.org
Mon Oct 11 15:34:58 EDT 2021
https://github.com/python/cpython/commit/320084fe7de90319928d8f3e597d5bca04db13f3
commit: 320084fe7de90319928d8f3e597d5bca04db13f3
branch: 3.9
author: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.com>
committer: miss-islington <31488909+miss-islington at users.noreply.github.com>
date: 2021-10-11T12:34:51-07:00
summary:
bpo-45351, asyncio: Enhance echo server example, print all addresses (GH-28828)
(cherry picked from commit 659812b451aefe1f0e5f83540296519a5fb8f313)
Co-authored-by: Olaf van der Spek <olafvdspek at gmail.com>
files:
M Doc/library/asyncio-stream.rst
diff --git a/Doc/library/asyncio-stream.rst b/Doc/library/asyncio-stream.rst
index 714de8d41a350..bf431cfb8a410 100644
--- a/Doc/library/asyncio-stream.rst
+++ b/Doc/library/asyncio-stream.rst
@@ -373,8 +373,8 @@ TCP echo server using the :func:`asyncio.start_server` function::
server = await asyncio.start_server(
handle_echo, '127.0.0.1', 8888)
- addr = server.sockets[0].getsockname()
- print(f'Serving on {addr}')
+ addrs = ', '.join(str(sock.getsockname()) for sock in server.sockets)
+ print(f'Serving on {addrs}')
async with server:
await server.serve_forever()
More information about the Python-checkins
mailing list