Three-way handshake
- The server enters the LISTEN state and waits for a connection
- The client sends a connection request to the server through CONNECT, SYN=1, SEQ = X, and the client enters SYN-SEND state
- When the TCP server receives the client connection, it sets both the SYN and ACK values to 1,seq=y, and ACK =x+1. At the same time, the TCP server enters the SYN-received state
- After the client receives the response from the server, it also needs to confirm the connection. Confirm that the ACK in the connection is set to 1, the serial number is seq = x + 1, and the ACK is y + 1. TCP specifies that this segment may or may not carry data. If it does not carry data, the sequence number of the next segment is still seq = x + 1. At this point, the client enters the ESTABLISHED (connected) state
- When the server receives the client’s confirmation, it enters the ESTABLISHED state
Four times to wave