The previous file delivered packets to the right building (IP address). A port — the flat number,
a 16-bit number — delivers them to the right program; servers listen on well-known ports like 443 and
5432, and clients get random ephemeral ones. Every connection is identified by its five-tuple, which is
why one server port can serve thousands of clients (Ch 1). Programs use the network through sockets — to
the kernel, just file descriptors — with servers calling socket, bind, listen, accept, and the bind
address deciding who can connect (127.0.0.1 = only me, 0.0.0.0 = everyone) (Ch 2).
On top of IP there are two ways to send. UDP is a postcard: ports and a checksum, nothing else — perfect
for DNS, video calls and games (Ch 3). TCP is a registered courier that promises a connection, reliability,
order, no duplicates, and not overwhelming anyone — delivering a byte stream, not messages (Ch 4). It starts
with the three-way handshake SYN, SYN-ACK, ACK, costing one round trip before any data (Ch 5). It numbers
every byte, the receiver ACKs what it has, and gaps are resent after a timeout or three duplicate ACKs
(Ch 6). It slows down for a full receiver (flow control) and for a jammed network (congestion control,
starting with slow start) (Ch 7). It closes politely with FIN or abruptly with RST, and states like
CLOSE_WAIT point to bugs in our own code (Ch 8). Its in-order promise causes head-of-line blocking, which
QUIC fixes with independent streams over UDP — the basis of HTTP/3 (Ch 9).
At the edge of a private network, NAT is the receptionist rewriting source addresses and ports and keeping a table so replies find their way back — which is also why incoming connections to your laptop fail (Ch 10). Firewalls and cloud security groups decide which ports, from which sources, may come in — with least privilege as the rule, "timeout" as the sign of a dropped packet and "refused" as the sign of a closed port (Ch 11). And because every new connection costs round trips, fast systems reuse connections — keep-alive for HTTP, connection pools for databases — since for most requests latency, not bandwidth, is the bottleneck (Ch 12).
The last networking file adds the human layer: names instead of numbers (DNS), and the language of the web itself (HTTP and HTTPS).