Skip to content
networkingprotocols

Three-Way Handshake

three-way-handshakenetworkingprotocols
Plain English

Before two computers talk over TCP, they shake hands: one says hello, the other says hello back, and the first confirms. Then data flows.

Technical Definition
  1. Client sends SYN with a starting sequence number.
  2. Server replies SYN-ACK.
  3. Client sends ACK.

A closed port answers SYN with RST. A firewall that drops gives no answer, so the client times out. A SYN flood abuses step 2. Connections close with FIN/ACK or RST.

Source: RFC 9293; CompTIA Network+ N10-009 Exam Objectives v4.0

Three-Way Handshake in practice

$ sudo tcpdump -ni lo 'tcp port 8080 and tcp[tcpflags] & (tcp-syn|tcp-ack) != 0' -c 3
Flags [S]  ...
Flags [S.] ...
Flags [.]  ...
In the Wild

Seeing [S], [S.], [.] in tcpdump is how you prove a connection got through, or see exactly where it stopped. Network+ N10-009 objective 1.4 covers TCP and UDP.