[Twisted-Python] Flush socket

Glyph Lefkowitz glyph at twistedmatrix.com
Fri Aug 12 00:06:25 EDT 2011

On Aug 11, 2011, at 7:43 PM, exarkun at twistedmatrix.com wrote:

> This will always be a somewhat unreliable way to test a remote process's 
> handling of packetization, since there are still two TCP/IP stacks which 
> can mess around with the data in a variety of ways, but it's as good as 
> you can do if you want to use normal sockets for this testing.

This bears repeating.  It's really unreliable.  Really.  The sizes of buffers passed to send() and recv() bear only a coincidental resemblance to each other; one test setup may reproduce them reliably when the next will suddenly behave completely differently.  If you want even a reasonably reliable heuristic here, you need to send() and then introduce a delay.  You can do this without your own IWriteDescriptor implementation though; just implement an ITransport that does its write() by breaking things up and then calling the underlying write() with callLater()s in-between.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://twistedmatrix.com/pipermail/twisted-python/attachments/20110812/083d76a4/attachment.htm 

More information about the Twisted-Python mailing list