What is Three-way Handshake?
Three-way Handshake is connection establishment process between client and server via TCP (Transmission Control Protocol).
This mechanism ensures reliable and ordered connection between two parties before data exchange begins.
How Does Three-way Handshake Work?
TCP connection establishment happens in three steps:
1. SYN (from client)
Client initiates connection and sends SYN packet (synchronize) to server with initial sequence number.
2. SYN-ACK (from server)
Server receives SYN, confirms it with ACK (acknowledgment), and simultaneously sends its SYN — i.e., server says: "I received your request and want to establish connection".
3. ACK (from client)
Client receives SYN-ACK, confirms it by sending ACK packet. After this connection is considered established, and data exchange begins.
Three-way Handshake Diagram
Why is Three-way Handshake Needed?
- Establishes reliable connection between client and server
- Agrees initial sequence numbers to avoid data loss
- Checks that both parties are ready for data transmission
Application
- When opening web page — your browser first establishes TCP connection with server using this process
- Used in HTTPS, FTP, SMTP and other protocols over TCP
Important:
Three-way handshake applies only to TCP. UDP protocol doesn't require connection establishment.
Conclusion
| Stage | What it Does |
|---|---|
SYN | Client requests connection |
SYN-ACK | Server confirms and offers connection |
ACK | Client confirms connection |
After this data transmission can begin.