The Internet - Lesson 5: Packets

Overview

Students learn that large messages sent over the Internet are actually divided into individual packets and explore the challenges this creates. Students begin in a simulation similar to the one in the previous lesson, except long messages will now need to be split into smaller parts -- and these parts may be lost or delivered out of order. They then design their own protocol that addresses these challenges. At the end of the lesson students watch a video and learn and the User Datagram Protocol (UDP) and The Transmission Control Protocol (TCP), two different protocols for sending messages broken into packets.

Goals

Students will be able to:

  • Describe how information flows through the Internet as a datastream of packets
  • Explain how packet numbering and re-ordering can allow for large messages to reliably be sent even if packets are dropped or arrive out of order
  • Explain the differences between the Transmission Control Protocol (TCP) and User Datagram Protocol (UDP)

Purpose

Information on the Internet is not sent all at once, but is instead broken into smaller chunks of data called packets. Each packet is sent through the Internet individually and may actually take different paths or arrive at different times than others. Once they arrive the receiver will use the packets to recreate the original file.

Two protocols used to send data as packets are UDP and TCP. The User Datagram Protocol (UDP) simply sends all the packets. If some arrive out of order or are entirely missing there's no system to fix the errors. The Transmission Control Protocol (TCP) numbers packets before sending them so that the receiver can correctly reorder the packets and request missing packets be resent.

Only one of these two protocols will be used, depending on the situation. TCP takes longer than UDP because of the error-checking done to guarantee every packet was received. TCP is used to send information like emails, images, websites, and more where saving fractions of a second is less important than accuracy. In instances like live-streaming television or online gaming where speed is most important, UDP will be used since it is faster and there's less benefit to correcting errors.

This lesson gives students a hands-on experience with the ideas behind both protocols and helps them understand the implications of splitting large files into packets when sending them online.

Note: UDP is not covered in the video at the end of the lesson.

Resources

Getting Started (5 minutes)

Prompt: Suppose our school library is moving to a new building on campus and the librarian has asked for your help.

  • What approach would you take if you just needed to clear out the space by the end of the day?
  • How would your approach change if you had more time and wanted to check that every book made it safely and was on the same shelf it was on before the move?
Discussion Goal

This prompt foreshadows the challenge students will see in today's lesson and also the core difference between the two protocols they'll look at, TCP, and UDP. You don't need to cover either of those at this point in the lesson. Some key points to draw out:

  • In the first instance you would probably just load them into boxes and carry them over. You might even be ok if some were lost or the order got messed up. What matters is speed.
  • In the second case there'd need to be some kind of record keeping to make sure that every book was recorded as well as the order it was placed in.
  • In both cases you wouldn't move the entire library at once, you would move boxes or chunks of books at a time.

Note this is a tight lesson with a significant wrap up. Aim to keep this warm up short and move to the main activity quickly.

Remarks

  • In the last lesson we learned that messages can take different paths to get to the same place on the Internet. Sometimes, we need to send really large messages over the internet, like movies or large pictures. Just like moving your entire school library, there are problems that arise when we want to send large messages on the internet. Today we're going to learn about two different protocols for sending information online, one that's used when all we care about is speed, and one that's used when accuracy is more important.

Activity (30 minutes)

Group: Place students into groups of 3-4. Assign each group a number, and then assign each individual student an "IP Address" using the same rules as in the previous lesson. (You may reuse the same numbers or give students new ones.)

Do This: Similar to last lesson, students will use index cards or other available methods to send messages to each other, with the teacher acting as the "router", delivering the messages (packets) to their final destination. Give your students these extra rules to follow during the simulation:

  • Students will only be allowed to send packets containing 8 characters of text! (If you notice more than 8 characters coming through in the packets, delete anything past the 8 allowed characters).
  • However, they may construct multiple packets prior to sending them, by using separate index cards, text messages, or email messages. Each message should be sent and distributed through the teacher for this simulation.
  • The Internet isn't perfectly stable -- there's a chance the receiver won't get your message in the exact way you sent it!
Teaching Tip

Here are a few key ways to simulate the instability of the Internet during this simulation:

  • Dropped packets. Occasionally discard some of the packets before they reach their destination.
  • Different routes. When delivering a message made up of many packets, they don't have to go through the same routers to arrive at their destination. You can split up packets and have them take separate routes.
  • Packets out of order. Packets aren't guaranteed to arrive in the same order they were sent. You can achieve this by having them take different routes, but you can also shuffle up some of the messages before you deliver them to simulate this.

Challenge #1: Send a Message

Do This: Have students send a multi-packet message to another classmate. They should aim for roughly 5 - 10 packets to increase the likelihood of some packets dropping or arriving out of order.

Teaching Tip

The goal of the first challenge is to let students see some of the issues that can arise due to packets being dropped, rerouted, or received in the wrong order. Once students have noticed these, you can move on. Most of the activity will be spent in the second half.

Remarks

  • As we've just seen, there are some issues with simply sending all of the packets. Packets can arrive out of order or totally get lost and there's no way for the computer to tell what happened. That said, it's a really simple protocol, and it's fast. In the real world, this is known as UDP or User Datagram Protocol.
  • Just like clearing out the library as fast as you can in the warm up, the goal of UDP is to send information quickly without worrying about accuracy. It's useful when split seconds matter more than correcting errors, like video-conferencing, live streaming, or online gaming.
  • Now let's see if we can develop a protocol that gives us better accuracy if we're ok taking some more time.

Challenge #2: Develop a Protocol

Do This: With their groups or with a partner, have students develop a protocol for reliably sending a message across an unreliable network. In particular, students should try to solve these problems with their protocol:

  • How will the receiver know the order of the packets or if any are missing?
  • How will the receiver request missing packets and what will the sender do in response?
  • How will both sender and receiver know the full message arrived successfully?
Teaching Tip

Encouraging Good Protocols: If students are unsure of how to write their protocols, try asking some of these questions:

  • Think back to the warm up. How would you label the moving boxes for the library?
  • Could you use a similar labeling system for the parts of your message?
  • Since we have limited space to work with for each message, what short codes could you use to label them? (Numbers, letters)
  • What signal can we send to let the receiver know how many messages to expect in total?
  • What signal can we send to let the sender know to resend a particular message?
  • What signal can we send to let the sender know we received all the messages?

More Than One Solution: There's lots of ways to solve this problem! Emphasize to students that while their protocol needs to solve the problem, there's not just one right answer and their solution doesn't need to look like their classmates.

Do This: Once students have developed their protocols, give two or three groups a chance to share their solutions with the class, either by describing it out loud or showing it on a projector at the front of the room. As a class discuss some of the shared features in their protocols. If short on time you may just ask students to raise their hands if their protocols included one of the features below.

  • Each packet is numbered or otherwise indicates which order it should go in
  • Each packet includes the total number of packets, again perhaps with a number, so the receiver knows how many packets to expect
  • The receiver requests missing packets or confirms received packets so the sender knows which to resend
  • The sender and receiver both know when the message has been successfully received

Remarks

  • We just developed a protocol that in the real world is known as TCP or Transmission Control Protocol. Thinking back to the warm-up again, TCP is like numbering every book in the library. It's slower but more accurate.
  • With TCP, we number packets so they can be re-ordered, confirm all were received, and resend any missing packets. There are multiple back and forth confirmations between the sender and receiver. TCP is useful when accuracy matters more than saving a split second, like sending emails, photos, or just browsing websites.

Wrap up (10 Minutes)

Remarks

  • The first protocol we looked (UDP) at was simple, but it had some problems. The second protocol we just invented (TCP) is much more accurate, but it takes longer. Depending on the situation, websites will choose the protocol that makes sense. Let's watch a video that teaches us more about how packets really work on the Internet with TCP.

Display: Watch The Internet: Packets, Routing, and Reliability - Video

Teaching Tip

The video includes a lot of information about how packets move through the Internet. The most important points for students to understand are that:

  • Large files are split into packets to be sent
  • Packets may take different routes through the network and arrive out of order
  • TCP ensures that packets that arrive out of order or are lost are re-ordered
  • Packets include metadata like their IP address or a packet number to help move them through the network or reorganize them when they arrive
  • Collectively this system makes the Internet more reliable

Covering UDP: UDP is not covered in the video and students do not need to understand it in great detail. The depth of explanation in the activity is sufficient to explain the differences between them and why each would be used.

Assessment: Check for Understanding

For Students

Open a word doc or google doc and copy/paste the following question.

Question

Which of the following is true regarding the way information is transmitted on the Internet?

  • Information flows on a dedicated direct connection from the sender's device to the receiver's device using binary electrical signals.
  • If a single packet is dropped, the entire file must be resent.
  • Because of the reliability of the Internet, packets always arrive in the same order they were sent.
  • Information does not travel in one piece, but rather as a datastream of packets.

Standards Alignment

  • CSTA K-12 Computer Science Standards (2017): 2-NI-04, 3A-NI-04, 3B-NI-03
  • CSP2021: CSN-1.B.5, CSN-1.B.6, CSN-1.C.1, CSN-1.C.2, CSN-1.C.3, CSN-1.C.4

Next Tutorial

In the next tutorial, we will discuss The Internet Lesson 6, which describes Learn how the different protocols of the Internet interact.