File tree Expand file tree Collapse file tree 1 file changed +36
-0
lines changed Expand file tree Collapse file tree 1 file changed +36
-0
lines changed Original file line number Diff line number Diff line change 1+ #include<stdio.h>
2+
3+ int main()
4+ {
5+ int w,i,f,frames[50];
6+
7+ printf("Enter window size: ");
8+ scanf("%d",&w);
9+
10+ printf("\nEnter number of frames to transmit: ");
11+ scanf("%d",&f);
12+
13+ printf("\nEnter %d frames: ",f);
14+
15+ for(i=1;i<=f;i++)
16+ scanf("%d",&frames[i]);
17+
18+ printf("\nWith sliding window protocol the frames will be sent in the following manner (assuming no corruption of frames)\n\n");
19+ printf("After sending %d frames at each stage sender waits for acknowledgement sent by the receiver\n\n",w);
20+
21+ for(i=1;i<=f;i++)
22+ {
23+ if(i%w==0)
24+ {
25+ printf("%d\n",frames[i]);
26+ printf("Acknowledgement of above frames sent is received by sender\n\n");
27+ }
28+ else
29+ printf("%d ",frames[i]);
30+ }
31+
32+ if(f%w!=0)
33+ printf("\nAcknowledgement of above frames sent is received by sender\n");
34+
35+ return 0;
36+ }
You can’t perform that action at this time.
0 commit comments