[Twisted-Python] ENOBUF and Twisted

James Y Knight foom at fuhm.net
Tue Aug 24 13:46:30 EDT 2004

Okay, I've done some testing on windows, and here is the problem:

With non-blocking sockets:
In Unix, socket.send(buf) will buffer as much of buf as it has space 
for, and then return how much it accepted. This could be 0 or up to 
something around 128K. If you send some data and then some more, it 
will append to the previous buffer.

In Windows, socket.send(buf) will either accept the entire buffer or 
raise ENOBUFS. Testing indicates that it will internally buffer any 
amount up to 50MB (this seems to be *TOTAL* for either the process or 
the OS, I'm not sure). However, it will not incrementally accept more 
data to append to a socket's buffer until the big buffer has been 
completely emptied (seemingly down to the SO_SNDBUF length, which is 
8192), but rather raises EWOULDBLOCK instead.

This makes me confident that the previous patch is the right thing to 
do and will fix the problem.


More information about the Twisted-Python mailing list