Intermediate Topic 21 of 50 Computer Networks
Three-Way Handshake
Exchange establishing a TCP connection.
How it works
TCP opens a connection with three messages: the client sends SYN with its initial sequence number, the server replies SYN-ACK with its own number and acknowledgement, and the client sends ACK. After this, both sides have agreed on starting sequence numbers and the connection is established. Closing uses FIN and ACK in each direction, with a TIME_WAIT state afterwards.
Step-by-step walkthrough
- The client sends SYN with its starting sequence number.
- The server replies SYN-ACK with its own number.
- The client sends ACK.
- Both sides now agree on sequence numbers.
- The connection is established and data can flow.
Where it is used
Every TCP connection, from a web page load to an SSH login, starts with it. It costs one round trip before data, which is why connection reuse, TLS session resumption and TCP Fast Open matter.
Common pitfall
SYN flood attacks fill the server's half-open connection queue; SYN cookies mitigate them. Firewalls dropping SYN-ACK cause timeouts. Latency from the extra round trip hurts short requests on long paths. Using keep-alive connections and pooling avoids repeated handshakes.
Where it fits in the course
Three-Way Handshake is topic 21 of 50 in Computer Networks, rated Intermediate. It follows UDP. The next topic is Flow Control.
Practice and explore
- Open the interactive lesson, with a mini quiz.
- Take the Computer Networks quiz.
How to study this topic
- Read the explanation above and restate the definition in your own words.
- Open the interactive lesson and answer its mini quiz.
- Read the common pitfall, then write a short example that avoids it.
- Check your understanding in the Computer Networks quiz, and revisit the topic if you miss a question.
Frequently asked questions
What is Three-Way Handshake?
Where do people use Three-Way Handshake?
What is the most common mistake with Three-Way Handshake?
What should I learn before this topic?
How can I practice it?
Is Three-Way Handshake hard to learn?
How long does it take to learn Three-Way Handshake?
Which topics are related to Three-Way Handshake?
What should I study after Three-Way Handshake?
Related topics
- UDP (Computer Networks)
- Flow Control (Computer Networks)
- TCP (Computer Networks)
- Congestion Control (Computer Networks)
- Three-Address Code (Languages & Compilers)