Stop – and – Wait protocol is data link layer protocol for transmission of frames over noiseless channels. It provides unidirectional data transmission with flow control facilities but without error control facilities.
This protocol takes into account the fact that the receiver has a finite processing speed. If data frames arrive at the receiver’s end at a rate which is greater than its rate of processing, frames be dropped out. In order to avoid this, the receiver sends an acknowledgement for each frame upon its arrival. The sender sends the next frame only when it has received a positive acknowledgement from the receiver that it is available for further data processing.
Sender Site: The data link layer in the sender site waits for the network layer for a data packet. It then checks whether it can send the frame. If it receives a positive notification from the physical layer, it makes frames out of the data and sends it. It then waits for an acknowledgement before sending the next frame.
Receiver Site: The data link layer in the receiver site waits for a frame to arrive. When it arrives, the receiver processes it and delivers it to the network layer. It then sends an acknowledgement back to the sender.
begin 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(); Make_Frame(); Send_Frame_To_Physical_Layer(); canSend = False; else if ( Event(Acknowledgement_Arrival)) then Receive_ACK(); canSend = True; end if end while end
begin while (true) //check repeatedly do Wait_For_Event(); //wait for arrival of frame if ( Event(Frame_Arrival) then Receive_Frame_From_Physical_Layer(); Extract_Data(); Deliver_Data_To_Network_Layer(); Send_ACK(); end if end while end
The following flow diagram depicts communication via simplex stop – and – wait protocol for noiseless channel: