[issue45351] List all sockets in TCP echo server using streams

2021-10-08 Thread Olaf van der Spek
Olaf van der Spek added the comment: > server = await asyncio.start_server(handle_echo, '127.0.0.1', ) If 127.0.0.1 is replaced by localhost, the server might listen on ::1 and 127.0.0.1 but only one address will be printed, which is confusing (and wrong IMO). So the output of the examp

[issue45351] List all sockets in TCP echo server using streams

2021-10-07 Thread Eric V. Smith
Eric V. Smith added the comment: I'm not clear why you're suggesting this change. Is this additional functionality, or is the current example broken? Is the text wrong, or just the code? -- nosy: +eric.smith ___ Python tracker

[issue45351] List all sockets in TCP echo server using streams

2021-10-03 Thread Olaf van der Spek
New submission from Olaf van der Spek : Replace: addr = server.sockets[0].getsockname() print(f'Serving on {addr}') By: for socket in server.sockets: addr = socket.getsockname() print(f'Serving on {addr}') https://docs.python.org/3/library/asyncio-stream.html -- assignee: docs@py