[Twisted-Python] Packet Fragmentation
Carl Zmola
zmola at acm.org
Thu Oct 9 08:44:21 MDT 2008
Nima,
The easiest way to do what you want is to put a count at the beginning
of your message and read that many bytes. The protocols that Glyph
suggested do this.
With TCP, you are responsible for keeping boundaries in the message.
TCP delivers a reliable two way STREAM of data. It hides all the
packets and handshakes from the programmer. Since it is reliable, the
easiest way to make messages is to add a count to the beginning of
your message.
Carl
Quoting Jean-Paul Calderone <exarkun at divmod.com>:
> On Thu, 09 Oct 2008 13:27:51 +0200, Vincent Bernat <bernat at luffy.cx> wrote:
>> OoO En cette nuit nuageuse du jeudi 09 octobre 2008, vers 00:51, Nima
>> Ghanavatian <nimag at rogers.com> disait :
>>
>>> I was wondering if there's any way in Twisted/Python to handle packet
>>> fragmentation. Can I access the last fragment flag in the TCP
>>> packet somehow?
>>> Or is there a total packet size sent with the packet automatically?
>>> If not, what would be the best way to solve this?
>>
>> You can also use a protocol that keeps message boundaries like UDP. UDP
>> is reliable and deliver messages in order if used on
>> localhost.
>
> UDP is *not* reliable and will *not* necessarily deliver messages in order,
> *even* if used on localhost. Please refer to Glyph's post.
>
> Jean-Paul
>
> _______________________________________________
> 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