Networks and Network Security (CS 560)

Project #3 (100 points)


Introduction

For this assignment, I am again providing you with some code. It can be found in the file proj3.tar.uu in my home directory on stu. Copy this file to your account on stu, uudecode it with the command "uudecode proj3.tar.uu". A file named proj3.tar will be created. Untar that file with the command "tar -xvf proj3.tar". A directory named proj3 will be created. Cd into the directory proj3 and follow the instructions in the README to compile and run the program.

The tcp_sim program simulates two machines, A and B, communicating over a network using the simple positive acknowledgement scheme described in section 12.4. As Comer described it on page 190: "The sender keeps a record of each packet it sends and waits for an acknowledgement before sending the next packet. The sender also starts a timer when it sends a packet and retransmits a packet if the timer expires before an acknowledgement arrives." Note that this is a much simpler (and less efficient) scheme than the sliding windows (see section 12.5) that TCP actually uses, but it is where we will start our discussion of ensuring reliability when the underlying communication mechanism (i.e. IP) is unreliable. Here is a sample run of the tcp_sim program:

Tick 0: A sends: sent_at=0 seq=0 ack_num=0 len=1 data=A
Tick 0: B sends: sent_at=0 seq=0 ack_num=0 len=1 data=D (lost)
Tick 2: B recvs: sent_at=0 seq=0 ack_num=0 len=1 data=A
Tick 2: B sends: sent_at=2 seq=-1 ack_num=1 len=-1 data=
Tick 5: A recvs: sent_at=2 seq=-1 ack_num=1 len=-1 data=
Tick 5: A sends: sent_at=5 seq=1 ack_num=0 len=1 data=B
Tick 6: B sends: sent_at=6 seq=0 ack_num=1 len=1 data=D
Tick 7: B recvs: sent_at=5 seq=1 ack_num=0 len=1 data=B
Tick 7: B sends: sent_at=7 seq=-1 ack_num=2 len=-1 data=
Tick 9: A recvs: sent_at=6 seq=0 ack_num=1 len=1 data=D
Tick 9: A sends: sent_at=9 seq=-1 ack_num=1 len=-1 data=
Tick 10: A recvs: sent_at=7 seq=-1 ack_num=2 len=-1 data=
Tick 10: A sends: sent_at=10 seq=2 ack_num=1 len=1 data=C (lost)
Tick 11: B recvs: sent_at=9 seq=-1 ack_num=1 len=-1 data=
Tick 11: B sends: sent_at=11 seq=1 ack_num=2 len=1 data=E
Tick 14: A recvs: sent_at=11 seq=1 ack_num=2 len=1 data=E
Tick 14: A sends: sent_at=14 seq=-1 ack_num=2 len=-1 data=
Tick 16: A sends: sent_at=16 seq=2 ack_num=2 len=1 data=C (lost)
Tick 16: B recvs: sent_at=14 seq=-1 ack_num=2 len=-1 data=
Tick 16: B sends: sent_at=16 seq=2 ack_num=2 len=1 data=F (lost)
Tick 22: A sends: sent_at=22 seq=2 ack_num=2 len=1 data=C
Tick 22: B sends: sent_at=22 seq=2 ack_num=2 len=1 data=F (lost)
Tick 24: B recvs: sent_at=22 seq=2 ack_num=2 len=1 data=C
Tick 24: B sends: sent_at=24 seq=-1 ack_num=3 len=-1 data=
Tick 27: A recvs: sent_at=24 seq=-1 ack_num=3 len=-1 data=
Tick 28: B sends: sent_at=28 seq=2 ack_num=3 len=1 data=F
Tick 31: A recvs: sent_at=28 seq=2 ack_num=3 len=1 data=F
Tick 31: A sends: sent_at=31 seq=-1 ack_num=3 len=-1 data=
Tick 33: B recvs: sent_at=31 seq=-1 ack_num=3 len=-1 data=

Summary:
Maximum segment size: 1
Timeout value for A: 6 Timeout value for B: 6
A->B delay: 2 B->A delay: 3
A->B loss rate: 0.33 B->A loss rate: 0.33

A transferred 3 bytes in 27 ticks
A sent 8 messages (data=3,ack=3,retrans=2)
A received: DEF
B transferred 3 bytes in 33 ticks
B sent 9 messages (data=3,ack=3,retrans=3)
B received: ABC

If you look at the file tcp_sim.h you will see that there are several constants that you can change (and recompile the program) to affect the simulation. For example, you can control the maximum number of bytes carried in a network packet by changing MAX_SEGMENT_SIZE. You can change the number of "ticks" it takes for messages to cross the network from A to B (or B to A) by modifying the DELAY_FROM_A_TO_B (or DELAY_FROM_B_TO_A) constant. You can also set the timeout value for each host (how many ticks it will wait for an acknowledgement before retransmitting), the loss rate for packets as they travel between the two hosts, and the actual data that will be transferred. To complete parts one and two of this assignment, you should not have to modify any of the code you are given except the tcp_sim.h file (you will need to recompile for the changes you make to tcp_sim.h to affect subsequent runs of the program).

Part 1: Understanding the simulation (40 points)

For this assignment you will be responsible for producing a report as outlined below. The first section of your report should be an introductory paragraph that describes the general purpose of the assignment. The second section of your report should demonstrate that you were able to run and understand the results of several simulations. Do this by working through several different runs of the tcp_sim program and trying to identify an instance of each of the following:

  1. A packet that contains only an acknowledgement and no data
  2. A packet that contains both data and an acknowledgement (called piggybacking)
  3. A lost data packet that causes a retransmission
  4. A lost acknowledgement that causes a retransmission
  5. A lost acknowledgement that does not cause a retransmission
  6. A timeout (not caused by a lost data packet or acknowledgement) that causes a retransmission

Cut and paste snippets of program output into section two of your report that illustrate each of the situations described above and describe in English what is happening. You will have to change some of the simulation constants in tcp_sim.h and run the program several times in order to observe all of the above phenomena.

Part 2: Experimenting with the simulation (60 points)

Also, run some tests to determine the effect that different values of the constants in tcp_sim.h have on the simulation. Section three of your report should address at least the following questions:

  1. What effect does increasing/decreasing the MAX_SEGMENT_SIZE have on the simulation and why?
  2. What effect does increasing/decreasing the TIMEOUT value(s) have on the simulation and why? Given a set of values for the other constants, are there ideal timeout values for A and B, and if so how can you find them?
  3. What effect does increasing/decreasing the network DELAY have on the simulation and why?
  4. What effect does increasing/decreasing the network LOSS rates have on the simulation and why?

Your report should end with a concluding paragraph that summarizes what you learned from this assignment.

Part 3: Implementing and experimenting with sliding windows (10 points)

This part of the assignment is optional and can earn you up to ten points of extra credit if completed. Modify the tcp_sim program to implement sliding windows as described in section 13.5 in Comer. You should only need to modify the tcp_sim.h and tcp_sim.c++ files to accomplish this. Include a brief section in your report that compares the performance of the old version of the program (positive acknowledgement) with the new (sliding windows) on several interesting runs.

What is due:

Good luck!