maximum data size in tcp segment

Answered Question
Dec 11th, 2010

Hi every body.

How are my net pro friends doing?

I have few question about the about the data field in tcp header.   I asked this question almost 7 month ago, as i was reading through my  post,  another question  arose in my mind.  

we know  that  whether the fragmentation occurs or not depends upon the data link  layer 's mtu,  for example for  ethernet has MTU of 1500 bytes.  So  if the  ip packet is   3000 bytes long,then   network layer has to perform fragmentation of the packet in case of ethernet.  The question remains  what would be maximum data could be put in the  tcp segment as it is data field 's size is not fixed.

Thanks and have a great weekend.

I have this problem too.
0 votes
Correct Answer by lgijssel about 4 years 7 months ago

Yes, that should be about it. TCP can carry options as well but with standard header sizes, the numbers match.

However, I must admit that I do not quite understand why you should want to know this.As you probably know, there is no LAN protocol today which can carry such a large payload. The now obscure 16Mbit Token Ring could handle about 16k and Jumbo frames on Gigabit Ethernet are generally supporting payloads of around 9000 bytes although the absolute max is higher.

regards,

Leo

Correct Answer by lgijssel about 4 years 7 months ago

The TCP header does not have a length field as such. The size of the packet is kept in the IP header's 'Total length' field.

Perhaps you are referring to the "Window Size" in the TCP header?

This is something different; it serves to indicate to the peer how much data can be accepted. (Without requiring an ACK).

In absolute figures, both fields are 16 bits long so the highest value they can hold is 65535 (64kByte).

regards,

Leo

Correct Answer by lgijssel about 4 years 7 months ago

An ip packet of 3000 bytes contains the following:

ip header, 20 bytes

tcp header 20 bytes

data 2960 bytes.

When sending this over a link with mtu=1500 you get the following:

packet 1: 40 bytes ip+tcp header and 1460 bytes of data.

packet 2: 40 bytes ip+tcp header and another 1460 bytes of data.

By now, 2920 out of 2960 bytes have been sent, the remainder goes in the last fragment.

packet 3: 40 bytes ip+tcp header and 40 bytes of data.

regards,'

Leo

  • 1
  • 2
  • 3
  • 4
  • 5
Overall Rating: 5 (3 ratings)
Correct Answer
lgijssel Sat, 12/11/2010 - 03:40

An ip packet of 3000 bytes contains the following:

ip header, 20 bytes

tcp header 20 bytes

data 2960 bytes.

When sending this over a link with mtu=1500 you get the following:

packet 1: 40 bytes ip+tcp header and 1460 bytes of data.

packet 2: 40 bytes ip+tcp header and another 1460 bytes of data.

By now, 2920 out of 2960 bytes have been sent, the remainder goes in the last fragment.

packet 3: 40 bytes ip+tcp header and 40 bytes of data.

regards,'

Leo

sarahr202 Sat, 12/11/2010 - 04:08

Thanks Leo for your response.

The question is  what would be the maximum data that can be put in  "  data field"  of tcp segment?.   Network layer is receiving tcp segments from upper layer, now whether  fragmentation could be performed or not, which depends upon data link layer's mtu, has nothing to do with size of data in tcp segment.In fact tcp would not be even aware of any fragmentation is being performed by network layer. So my question is what is the maximum quantity of data in ' data field"  that can be placed in tcp segment?

thanks

Correct Answer
lgijssel Sat, 12/11/2010 - 04:25

The TCP header does not have a length field as such. The size of the packet is kept in the IP header's 'Total length' field.

Perhaps you are referring to the "Window Size" in the TCP header?

This is something different; it serves to indicate to the peer how much data can be accepted. (Without requiring an ACK).

In absolute figures, both fields are 16 bits long so the highest value they can hold is 65535 (64kByte).

regards,

Leo

sarahr202 Sat, 12/11/2010 - 05:53

lgijssel wrote:

The TCP header does not have a length field as such. The size of the packet is kept in the IP header's 'Total length' field.

Perhaps you are referring to the "Window Size" in the TCP header?

This is something different; it serves to indicate to the peer how much data can be accepted. (Without requiring an ACK).

In absolute figures, both fields are 16 bits long so the highest value they can hold is 65535 (64kByte).

regards,

Leo

Thanks Leo for your response.

Sorry for the confusion here,  I understand the role of window field in tcp  segment.  What i am trying to understand is how much maximum data can be placed in " data field" of tcp segment.  As you said  , there is no length field in tcp header, so  how can we determine the maximum data that can be carried away in tcp segment?

please feel free to correct me if i am wrong, based on your reply, the maximum size of the data that can be placed in tcp segment is calculated as:

Ip header= 20 bytes   ( no option)

Tcp header= 20 bytes

total length field in ip header is 16 bits so  2 exp=65536 bytes

maximum data in tcp segment=  65536-ip header-tcp header=  65536-20-20=65496bytes.

Is it correct?

thanks

Correct Answer
lgijssel Sat, 12/11/2010 - 06:18

Yes, that should be about it. TCP can carry options as well but with standard header sizes, the numbers match.

However, I must admit that I do not quite understand why you should want to know this.As you probably know, there is no LAN protocol today which can carry such a large payload. The now obscure 16Mbit Token Ring could handle about 16k and Jumbo frames on Gigabit Ethernet are generally supporting payloads of around 9000 bytes although the absolute max is higher.

regards,

Leo

sarahr202 Sat, 12/11/2010 - 16:53

Thanks  Leo.  It was just curosity . You have a good weekend,

Actions

This Discussion