Protocol ExplorerGuidesPricing

TCP Handshake: SYN, SYN-ACK and ACK Explained

A TCP handshake establishes connection state and synchronizes sequence numbers between two endpoints. The three familiar messages are only the start of understanding what a trace shows.

Updated · Editorial approach and simulation limits

The three TCP handshake messages

A typical active open begins when the client sends a segment with SYN set. Its sequence number is the client’s initial sequence number, often written x. The SYN requests a connection and consumes one position in TCP’s sequence space even though it carries no application byte.

A listening server replies with SYN and ACK. Its own initial sequence number is y, and its acknowledgment field is x+1: the next sequence number it expects from the client after the client’s SYN. The client then sends an ACK with acknowledgment y+1. Both sides have now acknowledged the peer’s SYN and can move to the established state.

This pattern is often called the TCP three-way handshake. It is a model for a successful exchange, not a promise that every capture contains exactly three visible packets: loss, retransmissions, capture placement, simultaneous open, or other TCP extensions can change what an observer sees.

Sequence numbers count bytes, acknowledgments name the next byte

TCP presents an ordered byte stream to applications. Sequence numbers identify positions in that stream, rather than giving every packet a permanent packet number. If a segment carries data, its sequence number marks the first byte; the next segment may begin after the number of payload bytes sent.

An ACK field is cumulative: it normally reports the next sequence number expected from the peer. If a receiver acknowledges 501, it has received bytes up to but not including 501 in order. This is why an ACK must be interpreted against the opposite direction’s sequence space, not the segment that contains the ACK field.

SYN and FIN each consume sequence space as control flags. The sequence number shown on a SYN is the initial sequence number; the first data byte in that connection’s stream follows it. This helps explain why the first acknowledgment is often initial sequence number plus one.

What TCP options reveal during connection setup

A SYN can carry TCP options that influence the connection. Common examples include Maximum Segment Size, window scaling, timestamps and SACK-permitted. These options are proposed or negotiated during setup; a packet trace should be read in the context of what both peers offered and accepted.

The advertised receive window describes how much sequence space the receiver is prepared to accept at that moment. Window scaling allows a larger effective window when negotiated. It is a flow-control signal, not a statement about the link’s available bandwidth or the sender’s congestion window.

Options can be absent, filtered or changed by middleboxes, and not every endpoint uses every option. A SYN that lacks a familiar option may reflect policy or implementation rather than a failed TCP handshake.

Handshake completion does not mean the application is ready

After TCP reaches the established state, the peers can exchange stream bytes. The application may then send its own negotiation. For HTTPS over TCP, TLS handshake messages follow the TCP setup; HTTP requests and responses follow after the required TLS state is established.

HTTP/3 uses QUIC over UDP instead of TCP. QUIC includes transport and TLS handshake behavior in its own connection setup, so an HTTP/3 trace should not be expected to contain a TCP SYN sequence.

A TCP ACK confirms receipt by the remote TCP implementation. It does not prove that a remote application parsed, stored or acted on the bytes. For application-level confirmation, look for the protocol response or application logs.

SYN retransmissions, resets and incomplete opens

If a SYN is retransmitted, the client has not observed a usable response within its retransmission timer. Possible causes include packet loss, a filtered path, an unreachable host or a response lost on the way back. A trace from only one side cannot always distinguish these causes.

A server that is listening may answer with SYN-ACK. A host that is reachable but has no listener can answer with RST, though firewalls and policy can suppress or alter the visible result. A RST is not the same as a normal graceful close, which uses FIN and acknowledgment behavior.

A handshake that completes proves that the TCP endpoints exchanged the expected setup messages at that capture point. It does not prove that later TLS certificate validation, authorization, DNS dependency or application request processing will succeed.

A packet-by-packet reading checklist

First group packets by the two endpoint addresses and port numbers, then separate the two directions. Record the client’s SYN sequence number, match the server SYN-ACK, and verify that its acknowledgment is the client’s next expected sequence. Then verify the final ACK acknowledges the server’s SYN.

Next compare options in both SYN packets and note the receive windows. If data follows, count payload bytes rather than packet boundaries and match cumulative ACK values to the data stream. Retransmitted segments can repeat sequence ranges; the receiver’s acknowledgment tells you which bytes it has accepted in order.

Finally identify the first application protocol message. If the connection is TLS, inspect the TLS handshake at an authorized endpoint or use a key log; otherwise a network-only trace will usually expose timing and record sizes but not encrypted content.

Why a handshake can look different in real captures

Capture interfaces do not always see every packet. Asymmetric routing can send the reply through another interface, offload features can make locally captured segments look aggregated, and a firewall can drop or rewrite traffic before the chosen capture point. Apparent missing messages are evidence about that capture, not proof that a packet was never sent.

Sequence numbers are 32-bit values and arithmetic wraps modulo 2^32, so very long-lived streams do not increase without limit. Implementations compare sequence ranges within the active window rather than sorting the raw numbers as ordinary integers. This detail matters for packet analyzers and monitoring systems that calculate byte ranges across wraparound. Most analyzers unwrap sequence values for you; verify that view when comparing long sessions. The classic three-message exchange is not a latency benchmark. Round-trip time, congestion, DNS, TLS and server processing all affect how soon the application can use a connection. A SYN-ACK observed quickly does not tell you that the web page itself will load quickly.

The Protocol Explorer TCP animation uses illustrative addresses and timings to teach the sequence-number relationship. It is not a trace from your device or a substitute for RFC 9293 or an authorized packet capture.

Explore TCP interactively

Open the matching lesson to follow the exchange packet by packet. This is a scripted learning model with illustrative timing, not a capture of your network. The overview is free; the full lesson is included with the one-time Pro pass.

Open the TCP animation · Compare Free and Pro

Standards and primary sources

Use these specifications for authoritative protocol requirements. The lesson summarizes selected behaviors and does not replace the source documents.

Related protocol lessons

Browse all transport protocols ·

  • Compare TCP and QUIC connection setup