computer network practical file
December 10, 2016 | Author: harshit52sa | Category: N/A
Short Description
practical file for computer network for B TECH students...
Description
AIM-WAP FOR DESIGNING OSI MODEL Description-In data transmission and telecommunication, bit stuffing (also known—uncommonly— as positive justification) is the insertion of non information bits into data. Stuffed bits should not be confused with overhead bits. Bit stuffing is used for various purposes, such as for bringing bit streams that do not necessarily have the same or rationally related bit rates up to a common rate, or to fill buffers or frames. The location of the stuffing bits is communicated to the receiving end of the data link, where these extra bits are removed to return the bit streams to their original bit rates or form. Bit stuffing may be used to synchronize several channels before multiplexing or to rate-match two single channels to each other. Applications include Plesiochronous Digital Hierarchy and Synchronous Digital Hierarchy. Another use of bit stuffing is for run length limited coding: to limit the number of consecutive bits of the same value in the data to be transmitted. A bit of the opposite value is inserted after the maximum allowed number of consecutive bits. Since this is a general rule the receiver doesn't need extra information about the location of the stuffing bits in order to do the de stuffing. Program#include< stdlib.h> #include< graphics.h> #include< conio.h> #include< stdio.h> void main() { int driver, mode; int i,j; driver = DETECT; initgraph(&driver,&mode,""); outtextxy(250,450,"ISO OSI Model"); delay(2000); outtextxy(90,30,"Sender"); delay(500); setcolor(6); for(i=50;i< =350;i+=50) { rectangle(200,i,50,i+30); delay(500); } setcolor(10); outtextxy(70,60,"Application"); delay(500); outtextxy(70,110,"Presentation"); delay(500); outtextxy(70,160,"Session"); delay(500); outtextxy(70,210,"Transport");
delay(500); outtextxy(70,260,"Network"); delay(500); outtextxy(70,310,"Data Link"); delay(500); outtextxy(70,360,"Physical"); delay(500); setcolor(15); outtextxy(390,30,"Receiver"); delay(500); setcolor(6); for(i=50;i< =350;i+=50) { rectangle(350,i,500,i+30); delay(500); } setcolor(10); outtextxy(370,60,"Application"); delay(500); outtextxy(370,110,"Presentation"); delay(500); outtextxy(370,160,"Session"); delay(500); outtextxy(370,210,"Transport"); delay(500); outtextxy(370,260,"Network"); delay(500); outtextxy(370,310,"Data Link"); delay(500); outtextxy(370,360,"Physical"); delay(500); // sender Lines line(120,80,120,100); delay(500); line(120,130,120,150); delay(500); line(120,180,120,200); delay(500); line(120,230,120,250); delay(500); line(120,280,120,300); delay(500); line(120,330,120,350); delay(500); line(120,380,120,400); delay(500); // Physical Connection line(120,400,420,400);
// Receiver Lines line(420,380,420,400); delay(500); line(420,330,420,350); delay(500); line(420,280,420,300); delay(500); line(420,230,420,250); delay(500); line(420,180,420,200); delay(500); line(420,130,420,150); delay(500); line(420,80,420,100); //virtual connection setcolor(15); delay(500); outtextxy(210,35,"Virtual Connection"); delay(1000); for(j=65;j< =365;j+=50) { for(i=0;i< 15;i++) { setcolor(i); line(200,j,230,j); delay(10); line(235,j,265,j); delay(10); line(270,j,300,j); delay(10); line(305,j,335,j); delay(10); line(340,j,350,j); delay(10); } } delay(500); }
AIM-WAP FOR FINDING EVEN AND ODD PARITY Description-Parity:Parity of a number refers to whether it contains an odd or even number of 1-
bits. The number has “odd parity”, if it contains odd number of 1-bits and is “even parity” if it contains even number of 1-bits. Main idea of the below solution is – Loop while n is not 0 and in loop unset one of the set bits and invert parity. Algorithm: getParity(n) 1. Initialize parity = 0 2. Loop while n != 0 a. Invert parity parity = !parity b. Unset rightmost set bit n = n & (n-1) 3. return parity Example: Initialize: n = 13 (1101) parity = 0 n = 13 & 12 = 12 (1100) parity = 1 n = 12 & 11 = 8 (1000) parity = 0 n = 8 & 7 = 0 (0000) parity = 1 Program# include # define bool int /* Function to get parity of number n. It returns 1 if n has odd parity, and returns 0 if n has even parity */ bool getParity(unsigned int n) { bool parity = 0; while (n) { parity = !parity; n = n & (n - 1); } return parity; } /* Driver program to test getParity() */ int main() { unsigned int n = 7; printf("Parity of no %d = %s", n, (getParity(n)? "odd": "even")); getchar();
return 0; }
AIM-WAP TO IMPLIMENT DATA LINK LAYER FRAMING METHOD AS BIT STUFFING Description-In data transmission and telecommunication, bit stuffing (also known—uncommonly— as positive justification) is the insertion of non information bits into data. Stuffed bits should not be confused with overhead bits.
Bit stuffing is used for various purposes, such as for bringing bit streams that do not necessarily have the same or rationally related bit rates up to a common rate, or to fill buffers or frames. The location of the stuffing bits is communicated to the receiving end of the data link, where these extra bits are removed to return the bit streams to their original bit rates or form. Bit stuffing may be used to synchronize several channels before multiplexing or to rate-match two single channels to each other. Applications include Plesiochronous Digital Hierarchy and Synchronous Digital Hierarchy. Another use of bit stuffing is for run length limited coding: to limit the number of consecutive bits of the same value in the data to be transmitted. A bit of the opposite value is inserted after the maximum allowed number of consecutive bits. Since this is a general rule the receiver doesn't need extra information about the location of the stuffing bits in order to do the de stuffing. This is done to create additional signal transitions to ensure reliable reception or to escape special reserved code words such as frame sync sequences when the data happens to contain them. Applications include Controller Area Network, HDLC, and Universal Serial Bus. Program#include #include main() { char a[20],fs[50]="",t[6],r[5]; int i,j,p=0,q=0; clrscr(); printf("enter bit string : "); scanf("%s",a); strcat(fs,"01111110"); if(strlen(a)
View more...
Comments