[Twisted-Python] Non-blocking UDP output?
exarkun at divmod.com
Mon Nov 17 09:46:14 EST 2008
On Mon, 17 Nov 2008 15:47:29 +0800, Peter Cai <newptcai at gmail.com> wrote:
>Today I read this line in "Unix Networking Programming". It seems
>that UDP output might be blocking.
> We also said in Section 2.11 that there is no actual UDP
>socket send buffer. The kernel just copies the application data and
>moves it down the stack, prepending the UDP and IP headers. Therefore,
>an output operation on a blocking UDP socket (the default) will not
>block for the same reason as a TCP socket, but it is possible for
>output operations to block on some systems due to the buffering and
>flow control that happens within the networking code in the kernel.
>But as far as I know, when I write "transport.write" in twisted code,
> it actually called "sendto" on the socket without using "select".
>Doesn't this conflict with the "non-blocking" philosophy of twisted?
The UDP socket is in non-blocking mode, so writing to it will not block.
More information about the Twisted-Python