TCP 3-Way Handshake
Course Contents
1. What Is a 3-Way Handshake in TCP?
It’s the process that establishes a reliable connection before data transfer begins. This three-step exchange (SYN, SYN-ACK, ACK) ensures both devices are synchronized and ready to communicate.
Before two devices can communicate using the TCP protocol, they must first establish a TCP session. This ensures that both sides are ready to send and receive data in a reliable and ordered manner.
To do this, TCP uses a structured process called the 3-Way Handshake, which consists of three distinct steps:
- SYN – The client introduces itself and initiates the connection.
- SYN-ACK – The server replies, acknowledging the client and sharing its own connection parameters.
- ACK – The client confirms, and the TCP session is fully established.

Think of it like two people calling each other by name, confirming they can hear one another, and agreeing to start talking.
2. Steps of the 3 Way Handshake in TCP
The TCP handshake involves three distinct steps between the client (initiator) and the server (responder).
Step 1 – Client Sends SYN (Connection Request)
The client starts by sending a SYN packet to the server. This packet includes its Initial Sequence Number (ISN), which marks the starting point for the byte stream.
The client sends a SYN to the server with ISN=1000 for example.

Step 2 – Server Replies with SYN-ACK
The server responds with a SYN-ACK packet. It has two parts:
- It sends its own ISN, say 2000
- It acknowledges the client’s SYN by replying with ACK = 1001

Step 3 – Client Sends Final ACK
The client completes the handshake by sending an ACK (acknowledge) packet. This confirms the server’s SYN-ACK and establishes the connection. Data transfer can now begin.
The client sends an ACK with acknowledgment number 2001 (Server’s ISN + 1).

3. TCP Connection Termination
After data transfer is complete, TCP ensures a graceful termination of the connection between the client and server. This structured process prevents data loss and avoids leaving one side unaware of the closure. The connection termination follows four distinct steps.
Step 1 – Client Sends FIN
The client signals its intent to terminate the connection by sending a TCP segment with the FIN (Finish) flag set. This indicates that the client has no more data to send.
The client sends a FIN segment to the server, signaling the end of its data transmission !

Step 2 – Server Acknowledges FIN
The server acknowledges the client’s FIN request by responding with an ACK (Acknowledgment) segment. This confirms that the server has received the client’s request to terminate the connection.
The server sends an ACK segment to the client in response to the FIN request.

Step 3 – Server Sends Its Own FIN
After acknowledging the client’s FIN, the server sends its own TCP segment with the FIN flag set. This signals that the server has finished sending data and is ready to close its side of the connection.
The server sends a FIN segment to the client, indicating its readiness to terminate the connection.

Step 4 – Client Sends Final ACK
The client acknowledges the server’s FIN request by sending an ACK segment. This final acknowledgment completes the connection termination process, and the connection is fully closed.
The client sends an ACK segment to confirm the server’s FIN.

4. Conclusion
The TCP 3-Way Handshake is the process that establishes a reliable TCP connection between two devices.
By exchanging SYN, SYN-ACK, and ACK, both sides synchronize their sequence numbers and confirm they are ready to communicate.
This handshake is the foundation of TCP reliability, ensuring ordered delivery, error recovery, and proper flow control before any data transfer begins.