Maximum segment size


The maximum segment size is a parameter of the options field of the TCP header that specifies the largest amount of data, specified in bytes, that a computer or communications device can receive in a single TCP segment. It does not count the TCP header or the IP header. The IP datagram containing a TCP segment may be self-contained within a single packet, or it may be reconstructed from several fragmented pieces; either way, the MSS limit applies to the total amount of data contained in the final, reconstructed TCP segment.
To avoid fragmentation in the IP layer, a host must specify the maximum segment size as equal to the largest IP datagram that the host can handle minus the IP and TCP header sizes. Therefore, IPv4 hosts are required to be able to handle an MSS of 536 octets and IPv6 hosts are required to be able to handle an MSS of 1220 octets.
Small MSS values will reduce or eliminate IP fragmentation but will result in higher overhead.
Each direction of data flow can use a different MSS.
For most computer users, the MSS option is established by the operating system.

Default value

The default TCP Maximum Segment Size is 536. Where a host wishes to set the maximum segment size to a value other than the default, the maximum segment size is specified as a TCP option, initially in the TCP SYN packet during the TCP handshake. The value cannot be changed after the connection is established.

Inter-Layer Communication

In order to notify MSS to the other end, an inter-layer communication is done as follows:
While sending TCP segments to the other end, an inter-layer communication is done as follows:
MSS is sometimes conflated with MTU/PMTU, which is a characteristic of the underlying link layer, while MSS applies specifically to TCP and hence the transport layer. The two are similar in that they limit the maximum size of the payload carried by their respective protocol data unit, and related since MSS cannot exceed the MTU for its underlying link. However, the difference, in addition to applying to different layers, is that MSS can have a different value in either direction and also that frames exceeding the MTU may end up getting fragmented by the transport layer, while segments exceeding the MSS are simply discarded.