mirror of
https://github.com/python/cpython.git
synced 2025-12-23 09:19:18 +00:00
bpo-45351, asyncio: Enhance echo server example, print all addresses (GH-28828)
(cherry picked from commit 659812b451)
Co-authored-by: Olaf van der Spek <olafvdspek@gmail.com>
This commit is contained in:
parent
7d1ae89b84
commit
320084fe7d
1 changed files with 2 additions and 2 deletions
|
|
@ -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()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue