A Simplex Stop-and-Wait Protocol for a Noisy Channel


Simplex Stop – and – Wait protocol for noisy channel is data link layer protocol for data communications with error control and flow control mechanisms. It is popularly known as Stop – and –Wait Automatic Repeat Request (Stop – and –Wait ARQ) protocol. It adds error control facilities to Stop – and – Wait protocol.

This protocol takes into account the facts that the receiver has a finite processing speed and that frames may get corrupted while transmission. If data frames arrive at the receiver’s end at a rate which is greater than its rate of processing, frames can be dropped out. Also, frames may get corrupted or entirely lost when they are transmitted via network channels. So, the receiver sends an acknowledgment for each valid frame that it receives. The sender sends the next frame only when it has received a positive acknowledgment from the receiver that it is available for further data processing. Otherwise, it waits for a certain amount of time and then resends the frame.

Design

  • Sender Site − At the sender site, a field is added to the frame to hold a sequence number. If data is available, the data link layer makes a frame with the certain sequence number and sends it. The sender then waits for arrival of acknowledgment for a certain amount of time. If it receives a positive acknowledgment for the frame with that sequence number within the stipulated time, it sends the frame with next sequence number. Otherwise, it resends the same frame.

  • Receiver Site − The receiver also keeps a sequence number of the frames expected for arrival. When a frame arrives, the receiver processes it and checks whether it is valid or not. If it is valid and its sequence number matches the sequence number of the expected frame, it extracts the data and delivers it to the network layer. It then sends an acknowledgement for that frame back to the sender along with its sequence number.

Sender Site Algorithm of Simplex Stop – and – Wait Protocol for Noisy Channel

begin
   SeqNo = 0;     // Initialise sequence number of outbound frame
   canSend = True; //Allow the first frame to be sent
   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();
         frame = Make_Frame(SeqNo);
         Store_Copy_Frame(frame.SeqNo);
         Send_Frame_To_Physical_Layer(frame.SeqNo);
         Start_Timer(frame.SeqNo);
         SeqNo = SeqNo + 1;
         canSend = False;
      else if ( Event(Acknowledgement_Arrival)) then
         Receive_ACK();
         if ( ACK_No = SeqNo ) then
            Stop_Timer (frame.SeqNo);
            canSend = True;
         end if
      else if ( Event( Timer > Max_time)) then
Resend_Frame_To_Physical_Layer(frame.SeqNo-1);
Start_Timer(frame.SeqNo-1);
end if
end while
end

Receiver Site Algorithm of Simplex Stop – and – Wait Protocol for Noisy Channel

begin
RSeqNo = 0; // Initialise sequence number of expected frame
while (true) //check repeatedly
do
Wait_For_Event(); //wait for arrival of frame
if ( Event(Frame_Arrival) then
Receive_Frame_From_Physical_Layer();
if ( Corrupted ( frame.SeqNo )
doNothing();
else if ( frame.SeqNo = RSeqNo ) then
Extract_Data();
Deliver_Data_To_Network_Layer();
RSeqNo = RSeqNo + 1;
end if
Send_ACK(ACKframe[RSeqNo]);
end if
end while
end

Flow Diagram

The following flow diagram depicts communication via simplex stop – and – wait ARQ protocol for noisy channel −

Updated on: 30-Jun-2020

8K+ Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements