Why it matters

Every network conversation uses TCP/IP or UDP/IP. Understanding the stack shapes debugging and design choices.

Advertisement

The architecture

IP: routes packets by IP address. Best-effort; packets can be lost, duplicated, reordered.

TCP: reliable byte stream. Handles retransmission, ordering, flow control, congestion control.

UDP: thin wrapper around IP. Provides port multiplexing but no reliability.

TCP/IP stackIP layerpacket routingTCP layerreliable streamUDP layerunreliable datagramsTCP for reliability + order; UDP for speed + no overhead; both use IP underneath
Protocol layers.
Advertisement

How it works end to end

TCP three-way handshake: SYN, SYN-ACK, ACK. Sets up connection.

Sliding window: TCP allows multiple packets in flight, up to window size. Enables throughput.

Congestion control: slow start, congestion avoidance. Backs off on packet loss.

MSS + MTU: max segment/packet sizes. Affects throughput.