Network Layer

how stop-and-wait protocol work:

after transmitting one frame the sender waits for an acknowledgment before transmitting the next frame suppose if the acknowledgement does not arrive after a certain period of time the sender times out and retransmits the original frame but whatever it is only one frame can be sent at a time.

Drawbacks of stop-and-wait ARQ protocol:

 

  • The main drawback of stop-and-wait protocol is Sending one frame at a time because if we have a very high bandwidth and if that bandwidth can handle 1,000 data packets, but this protocol is sending only one data packet at a time so we are not properly utilizing the entire bandwidth.

  • Poor utilization of bandwidth
  • The poor performance if the bandwidth is not fully utilized obviously it leads to poor performance of the protocol

what is sliding-window protocol:

In stop-and-wait protocol we can send one frame at a time whereas in a sliding-window protocol we can send multiple frames at a time, how many number of frames can be send the number of frames to be sent is based on a parameter called window size.

So the sender and the receiver will have a window size and based on the window size only the number of frames to be sent is decided and each frame in this case is number which we call as a sequence number and this is for the brief introduction about the sliding window protocol.

Working of Sliding Window Protocol:

 
Now suppose, if we have a sender and we have a receiver. The sender has 11 frames to send and these are the frames as I already mentioned each frame is numbered for easy understanding the frames are numbered as 0 1 2 3 up to 10.

So total level frames are there in the sender side then how many frames can be sent at a time that is decided by a parameter called window size 

For Example:

 we will take the window size to be 4 it means 4 frames can be sent at a time.

 

Let’s say this is the first frame that is frame 0 is the first frame, let’s assume the sender is sending the first frame that is frame 0 once frame 0 is sent just notice there is a sliding window which is coming into action and it says frame 0 is sent but how many frames can be before expecting an acknowledgement in this case four frames can be sent before expecting an acknowledgment because this window size is the parameter that decides how many frames that can be transmitted before expecting an acknowledgement.

Sliding Window Protocol

Now in this case frame 1 can be sent just see the sliding window frame 2 can be sent and frame 3 also can be sent so a total of 4 frames  can be sent at the time.

Now after the receipt of frame 3 now frame 0 will be acknowledged by the receiver let’s say the receiver is acknowledging for frame 0 so this is an acknowledgement.

 if you observe here frame 0 is received by the receiver and the receiver has acknowledged that frame 0 is received once frame zeroes acknowledgement is received by the sender.

The sender now can send the next frame that is this frame number 4 now frame 4 is send. but keenly watch the sliding window the sliding window starts sliding a little bit it means frame 0 is acknowledged and frame for ascent

now let’s assume the receiver has acknowledged frame 1 in sender got the acknowledgment for frame 1 now what the sender does it can send the next frame the next frame in the buffer is frame 5 and the sender will now send frame,  once frame 5 is said what happens to the sliding window it moves a little bit and it says that frame number 2 are not acknowledged but frame number 0 and 1 are acknowledged, so this is what the scenario is frame number 0 and 1 are acknowledged and frame number 2 3 4 & 5 are sent but not acknowledged .

Now let’s assume frame number two is also acknowledged now what happens the sender will send the next to frame and the buffer the next frame and the buffer is frame number 6 now frame number 6 is sent to this receiver now what happens to the sliding window it slides a little bit so as to make a marking of the and acknowledge the frames and not knowledge of frames let me move this window size here, yes now we will analyze 

 

what are the things that are there in this part there are three parts these are the frames that are already sent and acknowledged if you observe here frame zero one two are acknowledged and that is what it is here and what about this that is in the current window this is the current window which contains the frame numbers three four five and six it means these are the frames three four five and six are sent already but not yet acknowledged so the middle portion is these frames are sent already but not acknowledged and what about frame seven eight nine ten if you observe here sender has not sent any frames with the number seven eight and nine ten so the last portion.window protocol and what we have seen