Homework 6

The due date for this homework is 11:59 PM on Friday night, April 5th.

This homework is continuation of hw5 with addition of pipelining. You can either use your solution of hw5 or the template. The homework template is available at:


To simulate an unreliable link in a single computer, you still need to run mininet. Like homework 5, run the following command and change the delay, loss and buffer size parameter.

sudo mn --link tc,delay='10ms',loss=5,max_queue_size=2 -x

At a high level, your job is to change the reliable transport protocol implementation in the template so that the following example execution always produces the correct result. In one terminal, you run the receiver in the following way, and it produces output as shown below.

./hw6_receiver <base port> > RECEIVED_FILE
# later on, this happens...
File received, exiting.

In a separate terminal, you run the sender:

cat ORIGINAL_FILE | ./hw6_sender <base port>
Sent 1020544 bytes in 25 seconds: 35 kB/s
Estimated RTT: 1029 ms

A few things to pay attention to:

  • hw6_sender.c, hw6_receiver.c - these are to be thought of as 'applications', using the 'library' you implement in hw5.c. You may change these files, but we will use the original files when grading.
  • hw6.c - this is where your code should go. You will need to make major changes to rel_socket(), rel_connect(), rel_send(), rel_receive() and rel_close().
  • The file transferred: your program should work for any file, and reproduce it exactly. You can check this with the md5sum utility, or diff.
  • The RTT: you are to dynamically estimate the RTT using the EWMA technique, and use this to set your timeout period. With correctly tuned timeouts, lower RTT will result in higher throughput.
  • Keep your packets smaller than or equal to MAX_PACKET (1400 bytes).
  • In case you buffer the packets and close the connection before you send all the packets, thoughput is also calculated in hw6_receiver. Make sure there is no significant difference between the throughputs of both sender and receiver.
  • Pay attention to the end of the connection. Ensure that both sides of the connection finish without user assistance, even if packet losses occur, while guaranteeing that the entire file is transferred. Look at the FIN/FINACK/ACK sequence in TCP for ideas.


  • For trying out your code, you can tune the packet loss ratios and round-trip latencies by changing the parameters to the proxy process.
  • Note that we'll use our own proxy process when grading, changing proxy.c is only going to hurt your chances.
  • In rel_close(), you may want to just wait for some time, to make sure the last ack didn't get lost (leaving one end hanging).

Turn-in instructions

Same story as previous homeworks, except that your makefile should generate two binaries called hw6_ receiver and hw6_sender. The script runs 10 times for each case and regard it as success if more than 7 throughput are faster than the threshold.

[SUCCESS] buf=2 loss=0% threshold=14 [1]: 1 [throughput(kB/s)= 37.0 32.5 28.3 27.8 42.3 28.2 28.5 27.6 28.8 28.4] mean=30.94 kB/s
[SUCCESS] buf=2 loss=5% threshold=2.1 [1]: 1 [throughput(kB/s)= 14.8 13.8 16.7 21.5 9.8 15.2 14.0 7.4 9.4 13.3] mean=13.59 kB/s
[SUCCESS] buf=10 loss=0% threshold=80 [1]: 1 [throughput(kB/s)= 151.2 151.1 151.5 151.3 151.1 151.3 151.9 151.1 151.5 151.5] mean=151.35 kB/s
[SUCCESS] buf=10 loss=5% threshold=10 [1]: 1 [throughput(kB/s)= 19.0 28.4 38.1 21.7 20.5 17.4 11.3 15.6 27.0 14.8] mean=21.38 kB/s
[SUCCESS] buf=100 loss=0% threshold=85 [1]: 1 [throughput(kB/s)= 162.4 162.3 162.3 162.3 162.2 161.3 162.3 162.4 162.3 162.3] mean=162.21 kB/s
[SUCCESS] buf=100 loss=5% threshold=10 [1]: 1 [throughput(kB/s)= 31.5 48.8 33.8 19.9 28.4 37.5 32.7 40.0 28.5 46.6] mean=34.77 kB/s

Total score: 6
Topic revision: r6 - 2013-03-29 - 16:16:17 - Main.ckanich
Copyright 2016 The Board of Trustees
of the University of Illinois.webmaster@cs.uic.edu
Helping Women Faculty Advance
Funded by NSF