I. TCP three-way handshake and four-way handshake
Flag space:
Syn (synchronous online)
Ack (acknowledgement confirmation)
Psh (push transfer)
FIN (finish)
RST (reset)
URG (Urgent urgent)
Sequence Number:
Sequence Number (sequential number) -- seq
Acknowledge number (confirmation number) -- ack
Format of the first handshake packet:
The second handshake packet format:
Format of the third handshake packet:
Three-way handshake:
After the connection is established, the data transmission mainly depends on the P Flag bit:
Four Waves of data packets, mainly refer to the f flag bit:
Ii. TCP status code
Status |
Description |
Closed |
Closed, no connection activity or in progress |
Listen |
Listening status, the server is waiting for connection to enter |
SYN rcvd |
Received a connection request, not confirmed |
SYN sent |
Connection Request sent, waiting for confirmation |
Established |
Connection established, normal data transmission status |
Fin wait 1 |
(Active close) a close request has been sent, waiting for confirmation |
Fin wait 2 |
(Active close) receives confirmation from the other party, waiting for the other party to close the request |
Timed wait |
Two-way close is completed, waiting for all groups to die |
Closing |
Both parties attempt to close the service at the same time and wait for confirmation from the other party. |
Close wait |
(Passive close) received the other party's close request, confirmed |
Last ACK |
(Passive close) Wait for the last close confirmation and wait for all groups to die |