โ† Networking Fundamentals

TCP/IP and Ports

~250 words ยท 2 min read

IP addresses

An IP address is a machine's address on a network โ€” like a postal address for data. IPv4 (e.g. 192.168.1.10) is still the norm; IPv6 (e.g. 2001:db8::1) adds vastly more addresses.

TCP vs UDP

Two protocols sit on top of IP:

  • TCP โ€” reliable, ordered, connection-based. Retransmits lost packets. Used for the web, email, SSH โ€” anything where every byte must arrive.
  • UDP โ€” fast, fire-and-forget, no guarantees. Used for DNS, video calls, games โ€” where speed beats perfect delivery.

The three-way handshake

Before TCP sends data, the two sides establish a connection:

Client              Server
  |--- SYN -------->|   1. "Want to talk?"
  |<-- SYN-ACK ------|   2. "Yes, ready!"
  |--- ACK -------->|   3. "Got it, let's go"

Only after this exchange does real data flow. UDP skips all of it โ€” it just sends.

The handshake is why a TCP connection has "latency" before the first byte. UDP starts instantly, which is why it powers real-time media.

Ports

A port identifies a specific service on a machine โ€” an apartment number to the IP's street address. Well-known ports:

  • 80 โ€” HTTP
  • 443 โ€” HTTPS
  • 22 โ€” SSH
  • 53 โ€” DNS
  • 3306 โ€” MySQL