1. TCP handshake protocol
In the TCP/IP protocol, the TCP protocol provides reliable connection services by using a three-way handshake to establish a connection.
First handshake: When establishing a connection, the client sends a syn packet (syn=j) to the server and enters the SYN_SEND state, waiting for the server to confirm.
The second handshake: When the server receives the SYN packet, it must confirm the customer's SYN (ack=j+1), and also send a SYN packet (syn=k), that is, SYN+ACK packet, at which time the server enters the SYN_RECV state.
Third handshake: The client receives the SYN+ACK packet from the server and sends the confirmation packet ACK (ack=k+1) to the server.
After three handshakes, the client and server begin to transfer data, and there are some important concepts in the above process:
Unconnected Queue: In the three-way handshake protocol, the server maintains an unconnected queue that opens an entry for each client's SYN packet (syn=j) that indicates that the server has received the SYN packet and issues a confirmation to the customer, awaiting the customer's confirmation packet. The connection identified by these entries is in a Syn_RECV state on the server, and when the server receives a confirmation packet from the customer, the entry is deleted and the server enters the ESTABLISHED state. Backlog parameter: Indicates the maximum number of unconnected queues.
SYN-ACK Retransmission Times If the server sends the SYN-ACK packet and does not receive the customer confirmation packet, the server performs the first retransmission, waits for a period of time without receiving the customer confirmation packet, and performs the second retransmission. Note that the waiting time for each repass is not necessarily the same.
Semi-connection survival time: refers to the maximum time that an entry in the semi-connection queue survives, that is, the maximum time from the time the service receives the SYN packet to the time when the packet is confirmed to be invalid, and the time value is the sum of the maximum waiting time for all retransmission request packets. Sometimes we also call semi-connected survival time time, SYN_RECV survival time.
|