Skip to content

Commit bb4f885

Browse files
bpo-45351, asyncio: Enhance echo server example, print all addresses (GH-28828)
(cherry picked from commit 659812b) Co-authored-by: Olaf van der Spek <[email protected]>
1 parent 56825b6 commit bb4f885

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

Doc/library/asyncio-stream.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -395,8 +395,8 @@ TCP echo server using the :func:`asyncio.start_server` function::
395395
server = await asyncio.start_server(
396396
handle_echo, '127.0.0.1', 8888)
397397

398-
addr = server.sockets[0].getsockname()
399-
print(f'Serving on {addr}')
398+
addrs = ', '.join(str(sock.getsockname()) for sock in server.sockets)
399+
print(f'Serving on {addrs}')
400400

401401
async with server:
402402
await server.serve_forever()

0 commit comments

Comments
 (0)