[Python-ideas] PEP 3156 feedback
Guido van Rossum
guido at python.org
Wed Dec 19 00:00:38 CET 2012
On Tue, Dec 18, 2012 at 2:49 PM, Andrew Svetlov
<andrew.svetlov at gmail.com> wrote:
> About protocols: I think eventloop should support UDP datagrams
Supporting UDP should be relatively straightforward, I just haven't
used it in ages so I could use some help in describing the needed
APIs. There are a lot of recv() variants: recv(), recvfrom(),
recvmsg(), and then an _into() variant for each. And for sending
there's send()/sendall(), sendmsg(), and sendto(). I'd be ecstatic if
someone contributed code to tulip.
> as well as operations with file descriptors which are not sockets at all.
That won't work on Windows though. On UNIX you can always use the
add/remove reader/writer APIs and make the calls yourself -- the
patterns in sock_recv() and sock_sendall() are simple enough. (These
are standardized in the PEP mainly because on Windows, with IOCP, the
expectation is that they won't use "ready callbacks" (polling using
select/*poll/kqueue) but instead Windows-specific APIs for starting
I/O operations with a "completion callback".
> I mean timerfd_create and inotify as examples.
I think those will work -- they look very platform specific but in the
end there's nothing in the add/remove reader/writer API that prevents
you from using non-socket FDs on UNIX. (It's different on Windows,
where select() is the only pollster supported, and Windows select only
works with socket FDs.)
--
--Guido van Rossum (python.org/~guido)
More information about the Python-ideas
mailing list