7 Nov '14

Anupa Manipal

A professional Software Developer in VB.NET - SQL Server and learner of PHP. Expertise in implementation of various projects including designing, development, coding and implementation of software applications.

0 Shares

Sliding window protocol

SLIDING WINDOW PROTOCOL

AIM:

To write a C program to simulate sliding window protocol

ALGORITHM:

  1. Start the program.
  2. Get the frame size from the user
  3. To create the frame based on the user request.
  4. To send frames to server from the client side.
  5. If your frames reach the server it will send ACK signal to client otherwise it will send NACK signal to client.
  6. Stop the program

 

PROGRAM:

#include<stdio.h>

int main()

{

int i,sq,ws,buf=20,ls=0,rcv[20],count,ack,ch;

do

{

count=0;

printf(“\n Enter window size:”);

scanf(“%d”,&ws);

if(buf>0)

{

for(sq=ls;count<ws;sq++)

{

rcv[sq]=sq;

printf(” Enter the data in number:”);

printf(“\n %d \n”,rcv[sq]);

count++;

buf–;

ls++;

}

}

else

{

printf(“\n buffer is full!”);

break;

}

ack=ls;

printf(“\n ACK NO=%d”,ack);

printf(“\n enter to quit or enter any no:”);

scanf(“%d”,&ch);

}

while(ch!=1);

}

OUTPUT:

Enter window size:5

Enter the data in number:0

Enter the data in number:1

Enter the data in number:2

Enter the data in number:3

Enter the data in number:4

ACK NO=5

Enter to quit or enter any nymber:2

Enter window size:10

Enter the data in number:5

Enter the data in number:6

Enter the data in number:7

Enter the data in number:8

Enter the data in number:9

Enter the data in number:10

Enter the data in number:11

Enter the data in number:12

Enter the data in number:13

Enter the data in number:14

ACK NO=15

Enter to quit

RESULT:

            Thus the simulation of sliding window protocol has been executed and verified successfully

About Anupa Manipal

A professional Software Developer in VB.NET - SQL Server and learner of PHP. Expertise in implementation of various projects including designing, development, coding and implementation of software applications.

Related Posts

Leave a Reply