How the Internet Moves Data

Understand packets, IP addresses, ports, TCP and UDP well enough to reason about where a request can fail.

Beginner · about 4 hours · difficulty 1/5

The internet is a network of networks that forwards small chunks of data called packets from one machine to another. Every device has an IP address (IPv4 like 203.0.113.7 or IPv6 like 2001:db8::1), and every program listening for traffic binds to a port (443 for HTTPS, 5432 for PostgreSQL). An address plus a port identifies one conversation endpoint.

Two transport protocols matter most to a backend developer:

  • TCP gives you a reliable, ordered byte stream. It performs a handshake, retransmits lost packets and slows down when the network is congested. HTTP/1.1, HTTP/2, database drivers and most APIs ride on TCP.
  • UDP just fires datagrams with no delivery guarantee. It is used where speed beats reliability (DNS lookups, video calls) and underneath QUIC, which powers HTTP/3.

Why this matters on the server side

When something is "slow" or "down", the cause is often below your code: a firewall blocking a port, a connection timing out during the TCP handshake, or latency between regions. Knowing the layers lets you ask the right question: is the name resolving, is the port reachable, is the TLS handshake finishing, or is my handler slow?

Pitfalls

  • Confusing latency (time for one round trip) with bandwidth (how much data per second). Chatty APIs suffer from latency even on fast links.
  • Binding a server to 127.0.0.1 and wondering why other machines cannot reach it; 0.0.0.0 listens on all interfaces.

You are ready to move on when you can sketch the path of a request from a laptop to a server and name what happens at each hop.

Key concepts

  • IP addresses (IPv4 and IPv6)
  • Ports and sockets
  • TCP handshake and reliability
  • UDP and QUIC
  • Latency vs bandwidth
  • Routers, NAT and firewalls
  • OSI and TCP/IP layer models: Useful vocabulary, not something to memorize.

Mini project

Write a tiny TCP echo server and client using your language's socket library, then use a tool like netcat or telnet to talk to it from another terminal.

Check yourself

Why might an API that makes 40 small sequential calls feel slow even on a gigabit connection?

Free resources