lwip-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [lwip-users] Reassemble fragmented TCP packets


From: Fabian Koch
Subject: Re: [lwip-users] Reassemble fragmented TCP packets
Date: Thu, 27 Aug 2009 09:54:35 +0200


address@hidden wrote on 26.08.2009 18:20:07:

> Hi all,

> Is lwip able to reassemble fragmented TCP packets? If yes, how?
> In fact my stack is supposed to receive a HTTP POST request split
> into 2 TCP fragments. At the TCP level, both fragments are set with
> "Position fragment/Fragment offset" = 0 and "More fragment"=0. As a
> result, ip_reass is never called. At the TCP level, does a mechanism
> of reassembly exist?


Short answer: yes.

Long answer: You have to be careful with the words here. On the IP Layer there is "fragmentation" which is only used when you have an Ethernet packet from a medium that a a bigger MTU (maximum transfer size). SO when a router gets a big packet and needs to send it on a physical medium that cannot handle the size of the packet, it gets fragmented in several IP packets with fragmentation flags.
On the TCP layer, there is "segmentation". Because TCP sees data as a stream, it is of course possible to send data that is longer than a single Packet is able to handle. The data is then basically just written into several packets and the other side puts the data stream back together.

LwIP has both features. For a TCP stream that just travels over Ethernet with constant MTU (1500), there will be no IP fragmentaton, only TCP segmentation.

When your application does a recv() you just tell it how much data you expect and it will return when that ammount has arrived.

regards,
Fabian
reply via email to

[Prev in Thread] Current Thread [Next in Thread]