-
-
Notifications
You must be signed in to change notification settings - Fork 178
Add UDP-related methods on the event loop. #321
Conversation
IIRC methods like That's why I'm considering that Proactor support is crucial for proposed functions (if we want to have them at all). |
I'm not against writing the code for Windows. According to the docs, |
Honestly I still don't want this at all. The sock_recv() methods etc.
are all kind of the wrong level and were added as compromises. Look at
how asyncio/streams.py provides a much more reasonable adaptation
compared to sock_recv() and sock_send().
|
I agree that the streams.py API is much better than the sock_* methods. I didn't want to put the UDP code there because it's not a streaming protocol. What if we added a create_datagram() function that creates a UDP socket wrapper with a sendto and a recvfrom coroutine? The returned object could have a bind(address) method, or we could add another method create_datagram_server(address) that creates the socket and binds it instantly. |
On 21 February 2016 at 17:18, Guido van Rossum [email protected]
IMHO, comparing the TCP and UDP cases is not reasonable. For TCP, the high-level interface you want is asyncio's stream API, so it's For the case of UDP, the high level interface you could possibly want is Sure, we could create a high level datagram sending API, but I am not Gustavo J. A. M. Carneiro |
I am the first to agree. This is why I am resisting the addition of [...]
My preference is to stick with the status quo. The OP seems to prefer |
All that functionality already exists in create_datagram_endpoint(), |
I will, thanks. |
Adds
sock_recvfrom
andsock_sendto
to the event loop. Tests were added, based on the other tests. There's no Proactor support yet, because it requires changingoverlapped.c
.I did some quick research and it seems that
sendto
might block, although it usually does not, hence why I also added it.