[Twisted-Python] Flush socket

Tobias Oberstein tobias.oberstein at tavendo.de
Thu Aug 11 17:18:40 EDT 2011

well, it does not necessarily correspond, but from what I see on tcpdump with
loopback device and on LAN (with TCP NoDelay set), it practically works.

the problem with your suggestion: I want to test the other end .. and that is
not Twisted (its i.e. Firefox .. the protocol to test is WebSockets)

On 11.08.11 23:13, "Christopher Armstrong" <radix at twistedmatrix.com> wrote:

On Thu, Aug 11, 2011 at 5:06 PM, Tobias Oberstein <tobias.oberstein at tavendo.de> wrote:
For testing implementations of a TCP-based protocol, I am testing
if an implementation is agnostic wrt to in what chops in receives
octets from the wire ("stream clean").

To do that, I force out octets from the protocol test driver (written
in Twisted) in differently sized chops, down to single octets.

While this is a noble goal, your method isn't really right: in TCP, the chunks you write on one end do not correspond to the chunks you receive on the other end after they've gone through a TCP stack and network. The best way to verify that your client is stream clean is to write unit tests that explicitly call its dataReceived method with different-sized chunks.

Christopher Armstrong

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://twistedmatrix.com/pipermail/twisted-python/attachments/20110811/8c66905e/attachment.htm 

More information about the Twisted-Python mailing list