Learning path

Full curriculum

Full curriculum

Arrows go from each prerequisite to the units that depend on it. Hover or focus a unit to highlight its path.

Unit content

TCP connection establishment and teardown

TCP maintains connection state at both endpoints, so peers must synchronize that state before exchanging a reliable byte stream.

Connection establishment uses a three-way handshake. Each side communicates an initial sequence-number state and confirms that bidirectional communication is working before ordinary stream data proceeds.

Closing is also stateful because the two byte-stream directions are independent. One endpoint can finish sending while still receiving data from the other. TCP therefore uses explicit FIN acknowledgements and temporary states that allow delayed packets from an old connection to expire safely.

A reset (RST) aborts a connection rather than performing an orderly close.

These mechanisms explain why a TCP connection is more than the pair of IP addresses and ports: it is a synchronized protocol state machine whose transitions govern which segments are meaningful at each moment.