MarketMaximum segment size
Company Profile

Maximum segment size

The maximum segment size (MSS) 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.

Default value
The default TCP Maximum Segment Size for IPv4 is 536. For IPv6 it is 1220. 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==
Inter-layer communication
In order to notify MSS to the other end, an inter-layer communication is done as follows: • The Network Driver (ND) or interface should know the Maximum transmission unit (MTU) of the directly attached network. • The IP should ask the Network Driver for the Maximum Transmission Unit. • The TCP should ask the IP for the Maximum Datagram Data Size (MDDS). This is the MTU minus the IP header length (MDDS = MTU − IPHdrLen). • When opening a connection, TCP can send an MSS option with the value equal to: MDDS − TCPHdrLen. In other words, the MSS value to send is: MSS = MTU − TCPHdrLen − IPHdrLen While sending TCP segments to the other end, an inter-layer communication is done as follows: • TCP should determine the Maximum Segment Data Size (MSDS) from either the default or the received value of the MSS option. • TCP should determine if source fragmentation is possible (by asking the IP) and desirable. • If so, TCP may hand to IP, segments (including the TCP header) up to MSDS + TCPHdrLen. • If not, TCP may hand to IP, segments (including the TCP header) up to the lesser of (MSDS + TCPHdrLen) and MDDS. • IP checks the length of data passed to it by TCP. If the length is less than or equal MDDS, IP attaches the IP header and hands it to the ND. Otherwise, the IP must do source fragmentation. ==MSS and MTU==
MSS and MTU
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 (frame for MTU, TCP segment for MSS), and related since MSS cannot exceed the MTU for its underlying link (taking into account the overhead of any headers added by the layers below TCP). However, the difference, in addition to applying to different layers, is that (1) MSS can have a different value in either direction and that (2) frames exceeding the MTU may cause packets (which encapsulate segments) to be fragmented by the network layer, while segments exceeding the MSS are simply discarded. ==Further reading==
tickerdossier.comtickerdossier.substack.com