TCP Handshake Basics
A compact note on how TCP opens with SYN, SYN-ACK, ACK and closes with FIN, ACK, FIN, ACK.
This poster summarizes the TCP connection lifecycle: the three-way handshake used to establish a connection, the meaning of common TCP control flags, and the four-way handshake usually used to close a connection.
1. TCP Three-Way Handshake
TCP uses a three-way handshake to establish a connection before data transmission.
Steps
-
SYN
The client sends a request to the server:
"I want to connect." -
SYN-ACK
The server replies with SYN + ACK:- ACK: "I received your request."
- SYN: "I am also ready to establish the connection."
-
ACK
The client replies:
"I received your confirmation."
After these three steps, the TCP connection is established.
2. TCP Four-Way Handshake
TCP usually uses a four-way handshake to close a connection.
Steps
-
FIN
Client says:
"I am done sending data. I want to close." -
ACK
Server says:
"I received your close request." -
FIN
Server says:
"I am also done. I want to close." -
ACK
Client says:
"I received your close confirmation."
After these steps, the TCP connection is closed.
3. Key Terms
SYN
SYN means synchronize.
It is used to start a TCP connection.
ACK
ACK means acknowledgment.
It means: "I received your message."
FIN
FIN means finish.
It is used when one side wants to close the TCP connection.
4. Simple Summary
- Three-way handshake = open a TCP connection
- Four-way handshake = close a TCP connection
- SYN = start
- ACK = received
- FIN = finish / close