Académique Documents
Professionnel Documents
Culture Documents
LIST OF EXPERIMENTS:
1. Implementation of Error Detection / Error Correction Techniques
2. Implementation of Stop and Wait Protocol and sliding window
3. Implementation and study of Goback-N and selective repeat protocols
4. Implementation of High Level Data Link Control
5. Study of Socket Programming and Client – Server model
6. Write a socket Program for Echo/Ping/Talk commands.
7. To create scenario and study the performance of network with CSMA / CA protocol
and compare with CSMA/CD protocols.
8. Network Topology - Star, Bus, Ring
9. Implementation of distance vector routing algorithm
DATE:
AIM:
To simulate go back n arq and selective repeat protocol and record its perfomence for
reliable data transfer.
ALGORITHM:
1) Sender keeps track of out sending frames and updates the variable and
window as acknowledgement archives.
2) Receive sliding window sends back the acknowledgement for the received
frame and notifies the next expected frame.
3) Commence transmission.
4) Deal with damaged or lost frame.
5) Deal with damaged or lost acknowledgement.
6) Deal with delayed acknowledgement.
7) Update sender window size.
8) Stop the program.
#include<stdio.h>
#include<stdlib.h>
#include<math.h>
#include<conio.h>
int n,r;
struct frame
{
char ack;
int data;
}
frm[10];
int sender(void);
void recvfrm(void);
void resend(void);
void resend1(void);
void goback(void);
void selective(void);
int main()
{
int c;
clrscr();
do
{
printf("\nMENU:");
printf("\n\n1.selective repeat ARQ\n 2.go back-n ARQ\n 3.exit");
printf("\n enter the choice");
scanf("%d",&c);
switch(c)
{
case 1:
selective();
break;
case 2:
goback();
break;
case 3:
exit(0);
break;
}
OUTPUT:
DATE:
AIM:
To write a c program to find the cycle redundancy check code for a given input
binary data word.
ALGORITHM:
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
char text[100];
char key[100];
char rem[100];
void crc()
{
int i,j;
int keylen,textlen;
char temp[100];
strcpy(temp,text);
keylen=strlen(key);
for(i=0;i<keylen-1;i++)
strcat(temp,"0");
textlen=strlen(temp);
strncpy(rem,temp,keylen);
while(i!=textlen)
{
if(rem[0]=='0')
{
strcpy(rem,&rem[1]);
rem[keylen-1]=temp[++i];
rem[keylen]='10';
continue;
}
for(j=0;j<keylen;j++)
rem[j]=((rem[j]-'0')^(key[j]-'0'))+'0';
}
}
main()
{
int i;
int choice;
while(1)
{
printf("\n1.find crc\n2.check crc\n3.quite\n enter your choice\t:");
scanf("%d",&choice);
switch(choice)
{
case 1:
printf("enter the input signal");
scanf("%s",text);
printf("\n enter the key");
scanf("%s",key);
crc();
printf("the transmitted msg is %s\n",strcat(text,rem));
break;
case 2:
printf("\nenter input string");
scanf("%s",text);
if(i==strlen (key)-1)
printf("\n there is no error in the msg");
else
printf("\n there is error in the msg");
break;
case 3:
exit(0);
}
}
}
EX:NO: 02
DATE:
include <protocol.h>
void main()
{
Frame X,Y;
X="data1";
Y="data2";
CSMACD_INIT();
CSMACD_START();
CSMA_SEND(B,A,X);
CSMA_SEND(A,C,Y);
R=COLLISION_OCCUR();
if(R)
{
WAIT(1000);
RETRANSMIT(B,A);
RETRANSMIT(A,C);
}
}
OUTPUT
CSMA / CA protocol
include <protocol.h>
void main()
{
Frame X;
X="data1";
CSMACA_INIT();
CSMACA_START();
NODE_LISTEN();
REQUESTTO_SEND(A,B);
CLEARTO_SEND(B,A);
DATATO_SEND(A,B,X);
ACKNOWLEDGE(B,A);
}
OUTPUT