AP Computer Science Principles · lesson 4 of 4 · 20 min
How the Internet works
The Internet is a global network of networks. Data travels across it in small chunks called packets . Each packet contains a header (source IP, destination IP, sequence number) and a payload (the actual data). Packets from the same message may travel different routes and arrive out of order — the receiving device reassembles them. This approach is called packet switching . It is more resilient than circuit switching (where a dedicated path is reserved for the entire conversation) because if one router fails, packets can be rerouted automatically.
IP addresses
Every device on the Internet has an IP address — a unique numerical label. IPv4 addresses are 32 bits written as four decimal octets: 192.168.1.1. IPv6 addresses are 128 bits written in hexadecimal: 2001:0db8:85a3::8a2e:0370:7334. IPv6 was introduced because IPv4’s ~4 billion addresses are exhausted. Public vs private IP addresses
Private addresses (192.168.x.x, 10.x.x.x, 172.16–31.x.x) are used inside local networks and are not routable on the public Internet. A router uses Network Address Translation (NAT) to map private addresses to a single public IP.
Protocols
A protocol is an agreed set of rules for communication. Key protocols: The AP exam frequently asks you to identify which protocol is used for a given scenario. HTTP/HTTPS for web, DNS for name resolution, TCP for reliable delivery.
The TCP/IP handshake
Before data is exchanged, TCP establishes a connection with a three-way handshake : SYN (client requests connection), SYN-ACK (server acknowledges), ACK (client confirms). This ensures both sides are ready before data flows.
Knowledge check
- Question of
- Hide hint
- Show hint
✓ Correct! ✕ Not quite
- Try again
- See results
- Next question
- Check answer
Previous lesson: Conditionals and Boolean logic
Back to AP Computer Science Principles