The Backbone of Reliable Communication
How a single keystroke triggers a symphony of protocols
Every TCP segment begins with a 20-byte minimum header. Click any field to learn what it does in our scenario.
Six 1-bit flags control the lifecycle of a TCP connection. Click any flag to see its role.
SYN and ACK are highlighted — they appear in the three-way handshake you're about to see.
The Window Size field in the TCP header tells the sender how much data the receiver can accept at once. It acts as a flow valve — the receiver controls the rate.
| Property | TCP | UDP |
|---|---|---|
| Connection | Connection-oriented (handshake required) | Connectionless (no handshake) |
| Reliability | Guaranteed delivery with ACKs | Best effort, no guarantees |
| Ordering | In-order delivery | May arrive out of order |
| Speed | Slower (overhead from headers and ACKs) | Faster (minimal header, no ACKs) |
| Error Recovery | Retransmission on loss | None — application must handle |
| Use Cases | HTTP, HTTPS, FTP, SSH, SMTP, IMAP | DNS, DHCP, VoIP, video streaming, TFTP |
Requires signature on delivery. Slower. You know it arrived. Used when every byte matters.
Fast, no confirmation. You don't know if it arrived. Used when speed matters more than perfection.
TCP tracks the current status of every connection. These states appear in netstat output.
netstat indicate high connection churn — normal for busy web servers.
Starts cwnd at 1 MSS. Doubles every RTT until ssthresh is reached. Despite the name, growth is exponential — it's only "slow" compared to sending at full speed immediately.
After ssthresh, increases by 1 MSS per RTT (linear). On packet loss: ssthresh = cwnd/2, then restart. This is TCP's main self-throttling mechanism on the Internet.
This is what Wireshark captures when your browser connects to hexworth.com on port 443. You can see the complete handshake before TLS negotiation begins.
TCP = Connection-oriented, reliable, ordered delivery. Operates at Layer 4 (Transport).
Three-way handshake: SYN → SYN-ACK → ACK. Required before any data transfer.
Four-way teardown: FIN → ACK → FIN → ACK. Both sides must independently close.
Know your ports: 20/21 FTP, 22 SSH, 23 Telnet, 25 SMTP, 53 DNS, 80 HTTP, 110 POP3, 143 IMAP, 443 HTTPS.
Six flags: SYN, ACK, FIN, RST, PSH, URG. Know when each is used.
Sequence numbers track bytes, not packets. ACK = "next byte I expect."
Window size controls flow. Window = 0 means stop sending completely.
DNS: UDP port 53 for queries, TCP port 53 for zone transfers. Common exam trap.
RST after SYN = port closed. No response = firewall or host unreachable.
TIME-WAIT = 2x MSL (~2 min). Prevents old packets from poisoning new connections.
Every time you type a URL and press Enter, TCP silently orchestrates hundreds of coordinated steps. It establishes trust, tracks every byte, recovers from loss, and gracefully closes when done. This entire process took under one second.