Skip to content
Related Articles

Related Articles

Improve Article
Save Article
Like Article

Utopian Simplex Protocol in Computer Network

  • Last Updated : 21 Dec, 2020

We will consider a protocol that is simple because it does not worry about the possibility of anything going wrong. Data are transmitted in one direction only. Both are transmitting and receiving network layers are always ready. Processing time can be ignored. Infinite buffer space is available. This thoroughly unrealistic protocol, which we will nickname “Utopia”, is simply to show the basic structure on which we will build. Its implementation is shown below.

A Utopian simplex Protocol :
There is one direction data transmission only from sender to receiver. Here we assume the communication channel to be error-free and the receiver will infinitely quickly process the input. The sender pumps out the data onto the line as fast as it can.

Attention reader! Don’t stop learning now. Get hold of all the important CS Theory concepts for SDE interviews with the CS Theory Course at a student-friendly price and become industry ready.

 

typedef enum {frame_arrival} event_type;

#include"protocol.h"

void sender1(void)
{
 frame s;                     /* buffer for an outbound frame */
 packet buffer;                /* buffer for an outbound packet */
 while(true)
 {
  from_network_layer(&buffer);   /* go get something to send */
  s.info=buffer;               /* copy it into s for transmission */
  to_physical_layer(&s);        /* send it on its way */
 }                           
}

void receiver1(void)
{
 frame r;
 event_type event;             /* filled in by wait, but not used here */
 while(true)
  {
   wait_for_event(&event);       /* only possibility is frame_arrival */
   from_physical_layer(&r);      /* go get the inbound frame */
   to_network_layer(&r.info);     /* pass the data to the network layer */
  }
}



This protocol has two different procedures, a sender and a receiver. MAX_SEQ is not needed because no sequence numbers or acknowledgments are used. The only event type possible is frame_arrival (i.e. the arrival of an undamaged frame).



The sender pumps out the data in an infinite while loop as fast as it can. The loop body consists of three actions and they are –

  • Fetch a packet from the network layer,
  • Construct an outbound frame using the variable s,
  • Send the frame on its way.

Other fields have to do with error and flow control and there are no errors or flow control restrictions here so only the info field is used here.

The receiver is equally simple. The procedure wait_for_event returns when the frame arrives and the event set to frame_arrival. The newly arrived frame from the hardware buffer is removed by the call from_physical_layer and puts in the variable r, so that receiver can get it. The data link layer settles back to wait for the next frame when the data portion is passed on to the network layer, suspending itself until the frame arrives. It does not handle either flow control or error correction therefore it is unrealistic.

My Personal Notes arrow_drop_up
Recommended Articles
Page :

Start Your Coding Journey Now!