G22.2262-001                                                        September 25, 2003

Assignment 2                                                        Due Date: October 16, 2003


[15 Points]


Get the cnet installation file and installation instructions and install cnet in you home directory on the NYU CS network.



Modify the STOPANDWAIT example provided in EXAMPLES and run simulations as follows:


  1. In the topology file, change:
    1. the probability of frame loss to 4 (1/16)
    2. the probability of corruption to 6 (1/64)
    3. the propagation delay to 50ms
    4. the message rate to 500ms (2 messages per second)


  1. Add an output to the reboot_node() function that displays your name, student ID, and Node ID.


  1. Add two-way data transmission.  Hint:  the documentation and the code itself describe how to make the program send data in both directions.


  1. Run STOPANDWAIT for 10 simulated minutes and record the statistics.


  1. Add code to allow a sender node's data fame to acknowledge a received frame.   We discussed this in class - it is called piggy backing ACKs onto data.  See Notes below.


  1. Again run the simulation for 10 simulated minutes and record the statistics.


  1. Compare the second set of statistics to the first set and explain any significant differences.  By significant I mean those statistics that are more than 10 percent different.  Ignore “Event” statistics – those whose name begins with “EV_”.


  1. Now, WITHOUT MODIFYING YOUR CODE FROM step 5 at all, change the propagation delay to 100ms and run your simulation again and record the statistics.  How do they compare to the results in step 6?  If they are different, explain why.





Your code should have two timers (for each node):


Tx Timer:              This is the timer that the sender sets after it sends a frame and will wait this amount of time for an ACK before resending its frame.  This timer is already implemented, but you will have to choose a new value.


Ack Timer:             This is a new timer that you will add to implement piggy backed ACKs.


You will have to pick TX and ACK timer values that are appropriate for the transmission and propagation delays.  It's part of your assignment to choose appropriate values (for example, it should be obvious that 1 millisecond and 1 second are poor choices). 


You will start your ACK timer when you receive a frame.  If your code gets a message from the higher layer to send data and the ACK Timer is active (that is, you "owe" an ACK to the other node), then stop the timer and set the ACK information into the outbound packet.


If the ACK timer is not active, then simply send the DATA packet and start your TX timer.


If the ACK Timer expires before you get a Data packet to send, then send an ACK packet.


If you receive a Data packet that ACKs a packet you sent, then stop your TX timer just as you do when you receive an ACK packet.


Of course, you will have to change the format of the packet to include both a send and an ACK sequence number.





  1. Your STOPANDWAIT topology file.
  2. Your protocol source file(s)
  3. The output from your three runs.
  4. Answers to questions 7 and 8.