TCP
the Transmission Control ProtocolTCP is how two programs get a reliable, ordered stream of bytes across an unreliable network. It opens a connection with a handshake, numbers every byte and acknowledges it, and resends anything that goes missing — the workhorse under the web, email and most of the internet.
TCP turns unreliable packets into a reliable, in-order byte stream — nothing lost, nothing out of order.
Open the TCP lab →
The three-way handshake, sequence and ACK numbers, and an honest four-way teardown.
How it works
Three messages agree on starting sequence numbers, so both sides can tell which byte is which and spot anything missing. Only then does data move.
What TCP does, step by step
SYN, SYN-ACK, ACK — both ends agree to talk and pick starting sequence numbers.
Data is split into segments, each byte given a sequence number so the far end can reassemble it in order.
The receiver ACKs what arrived; anything unacknowledged is resent, so nothing is lost.
A sliding window and congestion control tune the send rate to what the receiver and network can handle — then a FIN closes it.
In cybersecurity
TCP’s connection state makes it reliable — and gives attackers state to exhaust and a session to hijack. On its own it carries no encryption.
Half-open connections pile up to exhaust the server; SYN cookies defend against it.
Guessing or sniffing sequence numbers lets an attacker inject into a live connection.
A forged reset packet can tear a connection down — a classic censorship and DoS trick.
TCP sends in the clear — wrap it in TLS for privacy and integrity.
The handshake’s responses reveal which ports are open — the first step of recon.
Every connection costs memory; floods of them are a denial-of-service vector.