TCP details: TCP Data Interaction 2: TCP data interaction as mentioned earlier, TCP is a reliable protocol, because there is a data arrival confirmation mechanism between the sender and the receiver, if the sender does not receive a confirmation message within a certain period of time or the receiver receives a disordered message, re-sending ACK will trigger the sender to resend the message.
Www.2cto.com observe the packet capture above. The numbers 477651 to 477662 indicate the data interaction between the client and the server. During the interaction, the client sends 10 1024-length data packets to the server continuously, the C ++ code is as follows: for (I = 0; I <10; I ++) {send (m_clientSocket, buf, 1024, 0 );} note: 1: TCP will integrate the data packets submitted at the upper layer into a maximum packet for sending, such as 477652,477654. The packet segment length of these packets is exactly the length of MSS. Www.2cto.com 2: To prevent network congestion, the data packet sent from TCP at the beginning is not sent in the length of MSS, but is gradually increased according to the network situation, the transmission speed and length, as in the 477651, the length of the message sent is 1024, not MSS3: the receiving end does not confirm each data packet. Instead, it uniformly confirms all the data packets that arrive during the timer period, the server sends a package to the client, and the ACK package is sent to the client together with the package.