[Computer Network] TCP Transmission Control Protocol - three-way handshake

handshake process

Insert image description here

  1. At the beginning, both the client and the server are in the CLOSE state. First, the server listens to a certain port and is in the LISTEN state.
  2. Then the client actively initiates a SYN connection, and then is in the SYN-SEND state.
  3. The server receives the initiated connection, returns SYN, and ACKs the client's SYN, and is then in the SYN-RECV state.
  4. After receiving the SYN and ACK sent by the server, the client sends an ACK of ACK, and then is in the ESTABLISHED state, because it successfully sent and received.
  5. After the server receives the ACK of the ACK, it is in the ESTABLISHED state because it has also successfully sent and received.

Common test points

  • Why three handshakes instead of two?

Answer: Because when the received packet contains more than ACK, you need to reply with an ACK, otherwise a timeout and retransmission will occur. The server needs to receive the ACK sent by the ACK to establish a connection.

  • Why three handshakes instead of four?

Answer: Because the server can also send SYN packets while sending ACK packets, the reason is that these two flags do not logically conflict.

Guess you like

Origin blog.csdn.net/jia_03/article/details/132790996