Skip to content

Commit 320084f

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 7d1ae89 commit 320084f

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
@@ -373,8 +373,8 @@ TCP echo server using the :func:`asyncio.start_server` function::
373373
server = await asyncio.start_server(
374374
handle_echo, '127.0.0.1', 8888)
375375

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

379379
async with server:
380380
await server.serve_forever()

0 commit comments

Comments
 (0)