Thursday, April 21, 2016

Write A Program To Implement Selective Repeate ARQ Method.



#include<stdio.h>
#include<conio.h>
#include<dos.h>
#include<math.h>

int a[100],b[100],sender[100],receiver[100];

void main()
{
int i,j,n;
 
clrscr();
  printf("\n Enter How Many Frame: ");
scanf("%d",&n);
for(i=0;i<n;i++)
  {
  printf("\nENTER FRAME: %d",i+1);
  scanf("%d",&a[i]);
  }
  for(i=0,j=0;i<n;i++,j++)
  {
  b[j]=a[i];
  printf("\nSEND%d",b[i]);
  delay(800);

if(j==2)
  {
  printf("\t\tACK FOR FRAME: %d",0-(j+1));
    printf("\nLOST FRAME");
    delay(800);
    printf("\nRESEND FRAME");
    break;
  }
    printf("\t\tACK FOR FRAME: %d",i+1);
  }

  for(i=2,j=2;i<n;i++,j++)
  {
  b[j]=a[i];
  printf("\nSEND: %d",b[j]);
  delay(800);
  printf("\t\tACK FOR FRAME: %d",i+1);
  }
}

No comments:

Post a Comment