[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 example isn't wrong if you don't change it, but the 
example code itself could be better.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[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 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[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@python
components: Documentation
messages: 403084
nosy: docs@python, olafvdspek
priority: normal
severity: normal
status: open
title: List all sockets in TCP echo server using streams

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com