TCP protocol format --- 20 bytes fixed length + 40 bytes optional data

Table of contents

1. A fixed length of 20 bytes

16-bit source port and 16-bit destination port number, 32-bit sequence number, 32-bit confirmation sequence number, 4-bit header length (multiplied by 4)

 Reserved (6 digits)

16-bit window size

16-bit checksum and 16-bit urgent pointer

2. 40 bytes optional data

1.2.1. MSS: Maximum message length, which determines the maximum value of data sent by both parties of the TCP connection each time! ! !

 1.2.2. Why is it necessary to negotiate the maximum insulation end = section length?


1. A fixed length of 20 bytes

16-bit source port and 16-bit destination port number, 32-bit sequence number, 32-bit confirmation sequence number, 4-bit header length (multiplied by 4)

 Reserved (6 digits)

16-bit window size

Describes the size of the receive buffer

Why do you have to tell the other party the size of your receiving buffer when sending data?

                        It is to control the rate at which the message receiver sends messages to itself . If you send it to the other party saying that your receiving buffer is 0, then the other party cannot send it to you again, because you can’t receive it after sending it. To ensure reliability, you have to retransmit it. It is better not to send v than to retransmit it.

16-bit checksum and 16-bit urgent pointer

16-bit checksum : check whether the data is distorted during transmission

16-bit urgent pointer: send out-of-band data with the URG flag

2. 40 bytes optional data

1.2.1. MSS: Maximum message length, which determines the maximum value of data sent by both parties of the TCP connection each time! ! !

MSS is negotiated when the two parties shake hands three times

 1.2.2. Why is it necessary to negotiate the maximum insulation end = section length?

The essential reason : to prevent the message from being too large, data loss in the network, triggering the subsequent timeout retransmission mechanism

eg:

If the tcp data generated at one time has 5w bytes, it is directly thrown into the network. If this data is lost, it needs to be retransmitted, which is a double pressure on the network and tcp

Guess you like

Origin blog.csdn.net/flyingcloud6/article/details/128997004