Reliable Transmission on Unreliable Networks: TCP

What you will do: You will watch a video, read, and explore a simulation of unreliable IP transmissions.

What you will learn: You will learn about how the Internet sends data reliably by using protocols.

On your own: You can code your own Transmission Control Protocol.

6.2 Characteristics of the Internet influence the systems built on it.
6.2.1 Explain characteristics of the Internet and the systems built on it. [P5]
6.2.1A The Internet and the systems built on it are hierarchical and redundant.
6.2.1D Routing on the Internet is fault tolerant and redundant.
6.2.2 Explain how the characteristics of the Internet influence the systems built on it. [P4]
6.2.2B The redundancy of routing (i.e., more than one way to route data) between two points on the Internet increases the reliability of the Internet and helps it scale to more devices and more people.
6.2.2D Interfaces and protocols enable widespread use of the Internet.
6.2.2E Open standards fuel the growth of the Internet.
6.2.2F The Internet is a packet-switched system through which digital data is sent by breaking the data into blocks of bits called packets, which contain both the data being transmitted and control information for routing the data.
6.2.2G Standards for packets and routing include transmission control protocol/Internet protocol (TCP/IP).

When you send a message over the Internet, your computer divides it into small chunks called packets that it sends individually, each on its own path. A packet can include any kind of data: text, numbers, lists, etc. Computers, servers, and routers are fairly reliable, but every once in a while a packet will be lost, and devices on the Internet need to tolerate these faults.

The Transmission Control Protocol (TCP) guarantees reliable transmission by breaking messages into packets, keeping track of which packets have been received successfully, resending any that have been lost, and specifying the order for reassembling the data on the other end. This process is what makes the Internet a packet switching network.

Set Up Your Headphones or Speakers
If your connection blocks YouTube, watch the video here.

  1. Load this project. It provides a simulation of unreliable data transmission by Internet Protocol.
    • Click the green flag to initialize the incoming transmission variables before each experiment.
    • Click either character to enter a message for it to send to the other one.
  2. In this simulation, the complete message is a string of text that is divided into packets of one letter each. In reality, the packet length is not so strictly limited and messages are usually much longer.
    picture of TCP project stage
  3. Talk with Your Partner Compare the result with what you sent. What problems do you see?

TCP works by including additional information along with each packet so that the receiving computer can keep track of how many packets it has received, re-request any missing packets, and reorder the packets to reconstruct the original message. In this simulation, a packet either arrives correctly (even if it's out of order) or it doesn't arrive at all. But on the Internet, it's possible for a packet to arrive with erroneous data, so the real TCP has to check for errors and request re-transmission of packets with errors too.

  1. Read Blown to Bits pages 306-309.
Tough Stuff
  1. Build a simple TCP. Resolve the unreliability so that messages are received reliably despite the limitations of IP packets. You'll need to change the definitions of:
    • internet transmit () to ()
    • read internet data with ()
    Do not change the definition of send IP packet () to (sprite). That block simulates the unreliable network. You could "solve" the problem by rewriting this block to simulate a perfect network instead of an imperfect one, but that misses the point.
    To solve this problem, you'll need a way to keep track of the order of the data and a way to re-request missing packets:
    • First, solve the problem of packets arriving out of order. You can include extra header information in addition to the packet data in order to help the receiver reconstruct the message. This will require cooperation by both sender and receiver (that is, changes to both grey blocks).
    • Then, solve the problem of packets not arriving at all. That is, make the transmission reliable even though IP is unreliable. This, too, will require changing both sender and receiver.