G22.2262-001 September 25, 2003
Assignment 2 Due Date: October 16, 2003
Modify the STOPANDWAIT example provided in EXAMPLES and run simulations as follows:
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.