166 views
Suppose you want to transfer a file from Hyderabad to Bangalore.
The size of file is 90,000 bytes. The file will be transferred in 1,500-byte data packets, for which 40 bytes are taken up with headers. The size of acknowledgement packets is 40 bytes including header. Every packet is acknowledged. The communication is bidirectional and the bandwidth is 100 Mbps (megabits/sec) in each direction. Hosts can send and receive at the same time. The latency from Hyderabad to Bangalore is 5 ms, as is the latency in the opposite direction. Assume that time to process a packet is very small, so the receiver can send an acknowledgement as soon as it receives a data packet, but not before it receives the entire data packet.Assume no packet loss.  With Stop-and-Wait, how long will it take to transfer the file successfully?

### Subscribe to GO Classes for GATE CSE 2022

In the stop and wait protocol sender sends a data packet and waits for its acknowledgment and then transfers the next packet so here also the same transfer method will only be followed but the only thing which we need to take care of here in this question is that :

1. the communication is bidirectional here
2. in every data packet, the actual amount of data that will be transferred is 1500B – 40B = 1460B

So now we will find the number of packets required to carry 90000B is 90000B / 1460B = 61.64 packets which means 61 packets will carry 1460B of data and 62nd packet will carry 940B of data (excluding header).

The time to transmit one packet of 1500B is

(1500*8 )/ (100* 10^6) = 120 microseconds

Propagation time 5000 microseconds (given)

The transmission time of acknowledgment = 3.2 microseconds

Now 62nd packet acknowledgment time will be

(980*8) / (100* 10^6) = 7.84 microseconds

Now,

Total transmission time is [61( 120 + 2*5000+ 3.2) + (7.84 + 2*5000 + 3.2) ]  = 627526.24 microsecond = 627.526 milliseconds = 628 ms approx.

Hope This Helps !!!

So why are you not considering 5ms time latency for ACK too? Since it is given “The latency from Hyderabad to Bangalore is 5 ms, as is the latency in the opposite direction”
Bidirectional communication itself means that when the data packet is going from Hyderabad to Bangalore at the same time acknowledgment for previous packet is going from Bangalore to Hyderabad so that acknowledgment won't take any extra 5ms it's all in parallel.

“so the receiver can send an acknowledgement as soon as it receives a data packet, but not before it receives the entire data packet.” then please tell me what is meant by this line?

There is nothing new here as this is only what happens... When a packet is received completely then only its acknowledgment is sent.
@priyanshu.jha propagation delay for the ACK has to be considered. time taken by first 61 packets is 61(120 + 2*5000+ 3.2) = 68515.2 micro-sec and last packet is 61(120+2*5000+3.2) = 1081.6 micro-sec. total  69.59 ms
So a/c to you there is no significance of "the communication is bidirectional" this line...is it?
I think bidirectional means both side can send data but not simultaneously since “With Stop-and-Wait” is mentioned. After sender receives ack of last packet, it can send next packet. That is what happens in Stop-and-Wait. I know this much brother.
yes, I think you are right I have made the necessary changes.