A One-Bit Sliding Window Protocol

Computer NetworkComputer EngineeringMCA

Sliding window protocols are data link layer protocols for reliable and sequential delivery of data frames. The sliding window is also used in Transmission Control Protocol. In these protocols, the sender has a buffer called the sending window and the receiver has buffer called the receiving window.

In one – bit sliding window protocol, the size of the window is 1. So the sender transmits a frame, waits for its acknowledgment, then transmits the next frame. Thus it uses the concept of stop and waits for the protocol. This protocol provides for full – duplex communications. Hence, the acknowledgment is attached along with the next data frame to be sent by piggybacking.

Working Principle

The data frames to be transmitted additionally have an acknowledgment field, ack field that is of a few bits length. The ack field contains the sequence number of the last frame received without error. If this sequence number matches with the sequence number of the frame to be sent, then it is inferred that there is no error and the frame is transmitted. Otherwise, it is inferred that there is an error in the frame and the previous frame is retransmitted.

Since this is a bi-directional protocol, the same algorithm applies to both the communicating parties.

The algorithm of One – bit Sliding Window Protocol

begin
   frame s, r; //s and r denotes frames to be sent and received
   SeqNo = 0; // Initialise sequence number of outbound frame  
   RSeqNo = 0; // Initialise sequence number of expected frame
   while (true) //check repeatedly
   do
      Wait_For_Event(); //wait for availability of packet
      if ( Event(Request_For_Transfer) AND canSend) then
         Get_Data_From_Network_Layer();
         s = Make_Frame(SeqNo);
         Store_Copy_Frame(s);
         Start_Timer(s);
         SeqNo = SeqNo + 1;
      end if;
      Wait_For_Event(); //wait for arrival of frame
      if ( Event(Frame_Arrival) then
         r = Receive_Frame_From_Physical_Layer();
         if ( r.SeqNo = RSeqNo ) then
            Extract_Data(r);
            Deliver_Data_To_Network_Layer(r);
            Stop_Timer(r);
            RSeqNo = RSeqNo + 1;
         end if
      end if
      s.ack = r.SeqNo;
      Send_Frame_To_Physical_Layer(s);
      Start_Timer(s);
      SeqNo = SeqNo + 1;
   end while
end

Illustrative Example

The following diagram depicts a scenario with sequence numbers 0, 1, 2, 3, 0, 1, 2 and so on. It depicts the sliding windows in the sending and the receiving stations during frame transmission.

raja
Published on 20-Feb-2019 17:55:44
Advertisements