[Twisted-Python] twisted TCP frame size
Phil Mayers
p.mayers at imperial.ac.uk
Mon Feb 27 11:44:18 EST 2006
Thys Meintjes wrote:
> 1) is there a way to force dataReceived() to return when a certain data
> length has been received ?
dataReceived() is called via doRead() on the file descriptor, which is
called via a select([fd,], [], []) event in the default reactor.
If you are doing something (executing code) and a TCP segment comes in,
then another, then another, *then* you exit your code and the reactor
falls back to select(), it'll return with the fd and doRead() will be
called, and you'll get everything from the socket - 3 frames worth.
The correct question is, given your test script has a very small
dataReceived method that returns quickly (I presume), why isn't the
reactor "beating" the server and getting 49 bytes every time?
...to which I don't have a good answer. Which version of Twisted are you
running?
> 2) Why is dataReceived() so expensive (if it is) ?
Between select() returning and dataReceived() being called, the reactor
does lots of stuff related to running callLater's and stuff. I've found
that's all quite expensive in earlier versions of Twisted, but it
doesn't look like you use any of that, so I can't imagine that's it.
> 3) Is Protocol the correct tree or are there other ways to handle small
> time sensitive messages in twisted.
Is there a reason you can't use UDP?
>
> Apologies for the longish post.
>
> Regards
> Thys
>
>
>
> _______________________________________________
> Twisted-Python mailing list
> Twisted-Python at twistedmatrix.com
> http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python
More information about the Twisted-Python
mailing list