TCP three-way handshake
The three messages that open a TCP connection: the client sends SYN, the server replies SYN-ACK, and the client answers ACK.
In more detail
The exchange agrees starting sequence numbers in both directions, after which both sides are established and can send data. If the first SYN gets no reply the problem is below the application: routing, filtering or no listener. A packet capture shows exactly which step is missing.
Example
one=SYN two=SYN-ACK three=ACK result=established lists the handshake in order.Related terms
- SYN — The TCP flag meaning synchronize, set on the first packet a client sends to open a connection and on the server's reply.
- ACK — The TCP flag and number that confirm which bytes have been received, completing the handshake and keeping the stream reliable.
- socket state — The stage a TCP socket has reached in its lifecycle, such as LISTEN, SYN-SENT, ESTABLISHED or TIME-WAIT.
- TCP sequence number — The counter TCP attaches to every byte it sends, so the receiver can put data in order, spot gaps and acknowledge exactly what arrived.
- packet capture — Recording copies of the data packets that cross a network so they can be inspected later, by defenders or by eavesdroppers.
Taught in
- The Handshake, And The States A Socket Passes Through — Linux Fundamentals & Systems Administration