Why does the TCP protocol require a three-way handshake to establish a connection, but a four-way handshake for related connections?

Why shake hands in the first place:

As we all know, an important feature of TCP is its reliability. Before establishing a TCP connection, a synchronization sequence number needs to be established (note that the sequence number cannot start from 0). The synchronization sequence number is established through a handshake. The handshake can also synchronize the MSS (maximum message length). ) can also synchronize windows;

Why is there a 4-way handshake for closing a connection, and 3 for establishing a connection:

Because when closing the connection, you can leave the connection in a half-open state and continue to transmit messages (the half-open state can be left open for up to several days or even months. Under Linux, a timeout will never be set for the half-open state). When establishing a connection, It is not allowed to start sending messages in a half-open state, so the server must also send SYN when replying to ACK, so it is a three-way handshake when establishing a connection.

Guess you like

Origin blog.csdn.net/qq_37269542/article/details/131188408