summaryrefslogtreecommitdiffstats
path: root/Doc/library
diff options
context:
space:
mode:
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>2021-10-11 19:34:51 (GMT)
committerGitHub <noreply@github.com>2021-10-11 19:34:51 (GMT)
commit320084fe7de90319928d8f3e597d5bca04db13f3 (patch)
tree3169125344ef9d0cf0e244d7b64d04ea0f3e5c44 /Doc/library
parent7d1ae89b846c6965f7e0de1cc01a89db90c2667a (diff)
downloadcpython-320084fe7de90319928d8f3e597d5bca04db13f3.zip
cpython-320084fe7de90319928d8f3e597d5bca04db13f3.tar.gz
cpython-320084fe7de90319928d8f3e597d5bca04db13f3.tar.bz2
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@gmail.com>
Diffstat (limited to 'Doc/library')
-rw-r--r--Doc/library/asyncio-stream.rst4
1 files changed, 2 insertions, 2 deletions
diff --git a/Doc/library/asyncio-stream.rst b/Doc/library/asyncio-stream.rst
index 714de8d..bf431cf 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()