[Network] TCP three-way handshake understanding

TCP three-way handshake process:

The first handshake: the client sends a SYN packet (SYN=x) to the server, and enters the SYN_SEND state, waiting for the server to confirm.

The second handshake: The server receives the SYN packet, confirms the client's SYN (ACK=x+1), and at the same time sends a SYN packet (SYN=y); that is, ACK + SYN, and the server enters the SYN_RECV state.

The third handshake: the client receives the ACK + SYN packet, and sends the confirmation packet ACK (ACK = y+1) to the server. After the packet is sent, the client and server enter the ESTABLISHED state and complete the three-way handshake.

Popular understanding:

Client: Hello, are you there?

Server: Yes, what's the matter?

Client: Okay, I’ll talk to you later

To give an example of war: A and B want to attack C

1. A writes a letter to B saying: Tomorrow morning at 5 o'clock, attack C around

2. B receives the letter and writes back to A: OK, we will attack together tomorrow

3. A receives the letter and writes back to B: OK

If there is only 1 communication. A definitely dare not send troops. Because I don't know if B will come or not

If there are only 2 communications. B will definitely not dare to send troops. Because if A does not receive a reply, A will not send troops. If A does not send troops, B cannot fight.

If it is 3 communications. A knows that B will send troops, and B also knows that A will send troops. They reach a consensus and attack with confidence.

Guess you like

Origin blog.csdn.net/u013517229/article/details/127324098