Solution to Homework 6


Solution#1(10pts)

  1. The given code follows the operation shown in figure 3.14(b). Here it's assumed that both A and B start at the same time. This results in each of the frame transmitted twice. This will create a problem if the code at A and B are not started simulataneously.
  2. Remove the part of the code on B which transmits a frame before entering into the while loop.
  3. With this modification B will never get a chance to send first and if A does not have anything to send then B will have to just wait till it gets something from A.


Solution#2(5+5pts)

Failure Condition for Protocol 2:
Stop and Wait protocol presented here fails if one of the frames transmitted is lost. For example, A sends frame to B and B sends back an ack which gets lost. Now A keeps on waiting for an ack as there is no timeout occuring at A. So A is now hung up. The same thing will happen if the frame sent by A gets lost. In this case B never receives any frame and A is expecting to receive an ack from B.
One set of parameters to simulate this is, sim 2 1000 40 20 20 3

Failure Condition for Protocol 3:
This protocol fails due to immature timeout at sender's end that is when the sender times out too early. The flow here is,

Suppose timeout interval = 3.

Thus B never gets a packet with seq=1 which is lost in transmission.
One set of parameters to simulate this is, sim 3 1000 15 25 15 3