We’re all familiar with TCP, the three handshakes, reliable transmission, and all that jazz, but there are a few other things that are interesting, such as do you know what the size limit is for a TCP send?
Let’s review the TCP send process. First, the application layer calls a
send to put the data from the user state to the kernel state, which is a complicated process, but can be left off the table, and then the kernel state is handed over to the hardware-network card and then sent out again. We actually know very well that each layer in between has the concept of segmentation, for example, TCP will segment and IP will slice.
- TCP is segmented because of congestion control and traffic control
- IP is segmented because of the MTU (Maximum Transmission Unit) of the network.
So suppose I connect two PCs directly with a network cable, will a large TCP packet also be segmented? If not, what is the maximum TCP packet size that can be sent?
The MTU is generally not more than 1500, so the IP layer and above will be separated here; suppose we ignore this, then the IP layer, the maximum size of the IP layer is 65535, remove the 20 byte header, that is 65515 bytes, here can not be divided, then TCP is Then there is TCP, the shortest 20, then there is 65515-20, that is 65495 bytes, this is the maximum message data segment can be carried.
- The theoretical maximum TCP effective maximum data length is: 65495 (bottleneck: IP slice length)
- The actual maximum TCP effective maximum data length is: 1460 (1500-20-20, bottleneck: MTU)