Simon Bernier St-Pierre added the comment:

I want to have a loop that receives data like this:

socket = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
socket.bind(('0.0.0.0', port))
socket.setblocking(False)
while True:
    data, addr = await loop.sock_recvfrom(sock, 4096)
    # process packet

It's pretty similar to what the blocking code would look like, but it allows me 
to keep everything on a single thread without blocking. It could be done with 
the Protocol API, but I'd rather use the shiny new async/await API.

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue26395>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to