The TCP three-way handshake is the process used by the Transmission Control Protocol (TCP) to establish a reliable, bidirectional connection between two hosts. It is a foundational example of a protocol in action at the Transport layer (Layer 4 of the OSI Model).
The three steps are:
1. SYN — The initiating host sends a TCP segment with the SYN (synchronize) flag set, asking to open a connection.
2. SYN/ACK — The receiving host responds with a segment that has both the SYN and ACK (acknowledgment) flags set, acknowledging the request and synchronizing its own sequence numbers.
3. ACK — The initiating host replies with an ACK segment, confirming the connection. The channel is now established and data can flow reliably in both directions.
This handshake ensures that both sides agree on initial sequence numbers and are ready to communicate. Because it is a well-known and predictable protocol, attackers frequently target it — for example, by sending SYN floods to consume resources without completing the handshake.
The three-way handshake is the first step in the web browsing example from the text: after DNS resolves the hostname to an IP address, the browser uses TCP to establish a connection before sending an HTTP request.