Skip to main content

Unit 4 · Topic 4.1

4.1 The Internet

The internet is a network of networks that works because every device follows the same open rules, called protocols. This topic covers networks and paths, bandwidth, how data travels in packets, the main protocols (IP, TCP, UDP), and the difference between the internet and the World Wide Web.

Key terms

  • packet
  • protocol (IP, TCP, UDP)
  • routing
  • bandwidth
  • World Wide Web (HTTP)
  • scalability

Devices, systems and networks

A computing device is any piece of hardware that can run a program: a laptop, phone, tablet, server, router or smart sensor.

A computing system is a set of devices and programs that work as a team toward one goal, like the phones, servers and app behind a ride-sharing service. A computer network is a group of connected computing devices that can send and receive data. So a network is one kind of computing system.

A path between two devices is a sequence of directly connected devices that starts at the sender and ends at the receiver. Routing is the process of finding a path for data to take.

Bandwidth is the most data a connection can carry in a given stretch of time. It's usually measured in bits per second, often in megabits (millions of bits) per second. Bandwidth is like the width of a highway: more lanes let more cars through each second.

The internet

The internet is a network made of many interconnected networks: home networks, school networks, phone carriers and huge data-center networks, all linked together. To get on it, a device has to connect to something that's already connected, like a Wi-Fi router or a cell tower.

A protocol is an agreed-upon set of rules for how a system behaves, such as how data is formatted, addressed and sent. The internet's protocols are open, meaning anyone can use them for free and no single company owns them. That's why devices from different makers can all join, and why it's easy to add new devices.

Routing on the internet is usually dynamic: the path isn't decided in advance, and different pieces of the same message may take different routes depending on traffic and failures along the way.

Scalability is a system's ability to grow to meet new demand. The internet was designed to be scalable, which is how it grew from a few research computers to billions of devices.

Packets

Data travels across the internet as a data stream that's broken into chunks, and each chunk is wrapped in a packet. A packet holds a piece of the data plus metadata, such as where it came from, where it's going and its position in the sequence, so that routers can send it along and the receiver can put the pieces back together.

Packets can arrive in order, out of order or not at all. A video message might be split into thousands of packets that take different routes and arrive mixed up.

IP, TCP and UDP

ProtocolWhat it does
IP (Internet Protocol)Defines the addresses devices use (IP addresses) and handles routing packets toward the right one
TCP (Transmission Control Protocol)Makes delivery reliable: numbers the packets, puts them back in order, and asks for any missing ones to be sent again
UDP (User Datagram Protocol)Sends packets quickly without checking that they all arrive or putting them in order; good for live video calls and online games, where speed matters more than a few lost packets
HTTP (Hypertext Transfer Protocol)The protocol the World Wide Web uses to request and send web pages

The internet is not the Web

The World Wide Web is the huge collection of web pages, files and programs that link to one another. It uses HTTP and runs on top of the internet. The internet is the underlying network that carries the data. Email, online games, video calls and app updates also use the internet without being part of the Web.

A good way to remember it: the internet is the road system, and the Web is one kind of traffic on it.

Worked examples

Try each one yourself first, then open the solution.

  1. Example 1

    Bandwidth

    A school's internet connection has a bandwidth of 50 megabits per second. Roughly how long, at minimum, does it take to download a 200-megabit video file? Why might it take longer in practice?

    Show the solution
    1. Step 1: Bandwidth is the most data per second: 50 megabits each second.
    2. Step 2: 200 ÷ 50 = 4, so at least 4 seconds.
    3. Step 3: Bandwidth is a maximum. If many students share the connection, or packets are lost and resent, the download takes longer.

    Answer: At least 4 seconds; sharing the connection or resending lost packets can make it slower.

  2. Example 2

    Explaining packets

    A student video-calls a friend and the picture briefly freezes, then jumps ahead. Meanwhile, a file she downloads at the same time arrives complete and in order. Explain both using packets and protocols.

    Show the solution
    1. Step 1: Both the call and the file are split into packets that can take different paths and arrive out of order or not at all.
    2. Step 2: Video calls often use UDP, which doesn't resend lost packets. When some are lost, the video skips ahead instead of waiting.
    3. Step 3: File downloads usually use TCP, which puts packets back in order and requests any missing ones, so the file arrives complete.

    Answer: The call likely uses UDP, so lost packets are skipped (freezes and jumps); the download uses TCP, which reorders packets and resends missing ones.

Common mistakes

  • Using "the internet" and "the Web" as if they were the same. The Web is one service that runs on the internet.
  • Thinking packets always arrive in order, or always arrive at all.
  • Saying the internet's protocols are owned by one company. They're open, which is exactly what lets anyone connect.
  • Thinking routes are fixed in advance. Internet routing is dynamic.

On the exam

  • Expect questions about what happens to packets, what makes the internet scalable (open protocols, dynamic routing), and the difference between the internet and the Web.
  • Some questions describe a network with lettered devices and lines between them and ask about possible paths. Trace each path device by device.

Connected topics

Videos

  • AP CS Principles Exam Review - The Internet

    Flavio KupermanWatch on YouTube (opens in a new tab)

  • The Internet: IP Addresses & DNS

    CodeAIWatch on YouTube (opens in a new tab)

  • The Internet: Crash Course Computer Science #29

    CrashCourseWatch on YouTube (opens in a new tab)

  • Addressing and Protocols. Topic 4.1, Code.org Unit 2.3 walkthrough. 4 AP CSP review questions!

    Dr_WuWatch on YouTube (opens in a new tab)

  • Packets and Protocols

    CodeHSWatch on YouTube (opens in a new tab)

  • Bit Rate, Bandwidth, and Latency (AP Computer Science Principles Unit 2: The Internet)

    Professor CunninghamWatch on YouTube (opens in a new tab)

Check yourself

4 questions on 4.1 The Internet. Pick an answer to see if you got it, and why.

Question 1 of 4

Which of the following is NOT a computing device?

Question 2 of 4

Which of the following best describes the internet?

Question 3 of 4

Which statement about the internet and the World Wide Web is true?

Question 4 of 4

A browser asks a server for a web page, and the server sends the page back. Which protocol is the one the World Wide Web uses for these requests and responses?

0 of 4 answered