mirror of
https://github.com/python/cpython
synced 2026-09-29 12:10:30 +03:00
bpo-45351, asyncio: Enhance echo server example, print all addresses (GH-28828)
This commit is contained in:
parent
560a79f94e
commit
659812b451
1 changed files with 2 additions and 2 deletions
|
|
@ -395,8 +395,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()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue