Lab: Reliable Transport

In this lab, you will write a reliable transport protocol that uses cumulative ACKs, sliding window, and a retransmission timer, similar to TCP. You will use the simulator to examine the efficiency achieved by different window sizes.

Simulator

The Bene simulator includes stubs for TCP, including an implementation of TCP buffering and a TCP packet format.

TCP

Implement reliable transport using TCP as your model. The TCP code in the simulator is written so that no opening handshake is required; a host can immediately begin sending data. We will only simulate data traveling one way from the sender to the receiver, but the code is written so that you could send data in both directions.

Use the send and receive buffer implementation provided in the source code -- you should not need to change any of its code.

You should implement the following for the sender:

You should implement the following for the receiver:

The send buffer implements a basic sliding window algorithm, which is a buffer with three values called base, next, and last. The buffer is a sequence of bytes that can be transmitetd. The base of the window is the sequence number of the first byte in the buffer. The next value is the sequence number of the next data that has not yet been sent. Everything between the base and next is data that has been sent and not yet ACKed. The last value is the sequence number for the last byte in the buffer. Use the put() method to add data to the buffer, and the get() method to remove data from the buffer. use the resend() method to get data that needs to be resent. Use the slide() method when ACKing data that has arrived in order.

The receive buffer holds all the data that have been received, indexed by starting sequence number. Data may come in out of order, and the buffer will order them. Data may also be duplicated, and the buffer will remove any duplicated bytes.

Basic Tests

Use the simulator to set up a simple network consisting of two nodes and and one bidirectional link:

network

Using this network, test the following scenarios:

  1. Set the bandwidth of the links to 10 Mbps, with a propagation delay of 10 ms. Transfer the file test.txt from n1 to n2 using a window size of 3000 bytes. Repeat this test, with loss rates of 0%, 10%, 20%, and 50%.

  2. Set the bandwidth of the links to 10 Mbps, with a propagation delay of 10 ms. Transfer the file internet-architecture.pdf from n1 to n2 using a window size of 10000 bytes. Repeat this test, with loss rates of 0% and 50%.

Write a Python script for each of these tests, where the loss rate is passed in on the command line. The script should output traces from your TCP implementation demonstrating that it works well, and it should run a diff to ensure the file is transferred correctly. Use the transfer.py script as an example.

Fast Retransmit

Once you have basic TCP reliability working, add fast retransmit. This means that TCP detects a loss event when there are three duplicate ACKs (meaning the fourth ACK in a row for the same sequence number), and then immediately retransmits instead of waiting for the retransmission timer.

TCP may sometimes receive more than four duplicate ACKs. These additional duplicates should be ignored. Fast retransmit should only be done once and not repeated until a new, larger ACK is received.

When you add this functionality, add the capability to turn it on and off.

Run the following test:

  1. Set the bandwidth of the links to 10 Mbps, with a propagation delay of 10 ms. Transfer the file internet-architecture.pdf from n1 to n2 using a window size of 10000 bytes. Repeat this test, using a loss rate of 20%, both with and without fast retransmit.

Use a Python script for this test that prints out traces from your TCP implementation demonstrating that it works well, and runs a diff to ensure the file is transferred correctly. Use the transfer.py script as an example.

Experiments

Using the same network configuration as above, set the bandwidth of the links to 10 Mbps, with a propagation delay of 10 ms, a queue size of 100 and a loss rate of 0%. Transfer the internet-architecture.pdf file using window sizes of 1000, 2000, 5000, 10000, 15000, and 20000 bytes. Compute the throughput of the transfer as the total bits sent divided by the total time to send the file, measured from the start of the simulation to when the last segment is received. Compute the average queueing delay of all segments sent. Plot the throughput and the average queueing delay as a function of the window size, on two separate graphs.

Report

Write a formal, scientific report that includes the following:

Be sure that your report is written in a scientific style, with complete sentences and paragraphs that flow together. Your report should be written as if you are explaining your work to another CS student, and they need all of the details of what you did so that they can replicate your experiments.

Your report can be any length, as long as you thoroughly describe your project and results. The paper must use 11 point type, single spacing, and one column per page.

You must use LaTex to write your report. This will make it easy for you to include code and graphs and give them a consistent style. You will also be able to easily regenerate your report whenever you change your graphs, without having to copy and paste them each time. You can use this template for your report.

Submission

Your code should be located in a directory called lab2 in the top level:

bene/
  src/
  examples/
  lab2/

You should copy tcp.py to the lab2 directory and modify it there. You should be sure your scripts call this tcp.py and not the one in the src directory. Turn in a tarball that includes all of your code (for the simulator, experiments, graphing, etc), and a PDF of your report:

 tar -czvf bene.tgz bene 

using Learning Suite.

Grading

This lab is worth 200 points, and will be graded using the following rubric:

Each part will be graded on the following scale:

To get full points, all tests must pass and the report must be complete and written with a scientific style.