High School Computer Science and Programming Workshop
Class 14: Internet Protocols


Hesam Samimi, Cliff Kushler
Ananda Living Wisdom School



Here is a direct link to Snap!


To play with Snap! you can just click on the play button on some of the images, like the one above. If you have any problems with it loading, visit Snap! directly in a new browser tab (On that page, click "Run Snap! now"). Another possible solution, if your browser is not Chrome, is to give Chrome a try.


The Internet

Ever wondered how beautifully The Internet works? It's the largest thing humans have ever built (in recorded history), yet it always works perfectly and without ever breaking!

Sure, you hear of systems getting hacked and what not, but that's because of faulty and insecure software somebody wrote that runs on the internet, not the internet system itself.

It cannot break because the internet isn't a central thing. Rather, it consists of billions and billions of connected individual nodes, somewhere on the planet. Thus, if any number of them break, it is no big deal. The whole thing is still connected and can connect anybody with everyone else on it.


How the Internet Works

You may already have some ideas how the internet basically works. Take a moment to watch this well-done short video from the World Science Festival to be sure we're covered:


TCP Ensures Reliable Delivery

As you saw in the video above, the IP or Internet Protocol sets up a nice way to deliver packets between two nodes on the internet.

But delivery is by no means guaranteed by IP! Packets can get too much delayed, dropped, or lost. Connections may drop, servers may crash, and so on.

TCP or Transmission Control Protocol sits on top of IP, using it with the goal of ensuring delivery. It keeps track of packets sent, waits to receive back acknowledgment, or ACK from the destination, and makes sure the packets are received in the right order, before sending out new packets. When packets are not received, TCP resends them.

Note that we still cannot really say TCP "guarantees" delivery, because, at least theoretically, if all nodes on the internet are down nothing can get across! But still, we can definitely say it "tries hard" to ensure all packages are delivered properly to the right destination.


TCP When Everything Is Smooth

Here is a nice animation showing TCP in action when all packets are getting nicely delivered, in time and in order. Try to infer how the protocol works:

Notice that TCP isn't sending all packets at once. (If every node was sending all its packets at once, then the internet would quickly come to a grinding halt from so much congestion!. Only packets within a Sliding Window are on flight, at a given moment.

Q. How is the Sender behaving?

Q. How is the Receiver behaving?


TCP When Packets Are Dropped

Here is an animation showing TCP saving the day when some packets (or their ACKs) are getting dropped. Try to infer how the protocol is working:

Q. What happened when packet B got dropped?

No worries if there is too much going on here to follow! I just wanted you to get a sense of how these protocols work...


Next: Outro Class: Next Steps
Previous: Class 13: State Machines
Back to: Table of Contents