CN Lab - Manual (2023-24) Odd Sem

Download as pdf or txt
Download as pdf or txt
You are on page 1of 58

COMPUTER NETWORKS LABORATORY 2023-24

ATRIA INSTITUTE OF TECHNOLOGY


(Affiliated To Visvesvaraya Technological University, Belgaum)
Anandanagar, Bangalore-24

DEPARTMENT OF ELECTRONICS AND COMMUNICATION

COMPUTER NETWORKS LAB


MANUAL

SEVENTH SEMESTER ELECTRONICS AND COMMUNICATION

SUBJECT CODE: 18ECL76

Lab Manual Prepared by:

Dr. Ramesh Nuthakki


Associate Professor
Dept of E&C

2023-24

1
COMPUTER NETWORKS LABORATORY 2023-24

ATRIA INSTITUTE OF TECHNOLOGY


(Affiliated To Visvesvaraya Technological University, Belgaum)
Anandanagar, Bangalore-24

DEPARTMENT OF ELECTRONICS AND COMMUNICATION

COMPUTER NETWORKS LAB MANUAL

The Computer Networks Laboratory Manual pertaining VII semester


ECE has been prepared as per VTU syllabus and all the experiments are
designed, tested and verified according to the experiment list.

This manual typically contains practical/lab sessions related to Computer


networks, implemented in Network Simulator and C code covering various
aspects related to the subject for better understanding. Students are advised to
thoroughly go through this manual as it provides them practical insights.

Good Luck for your Enjoyable Laboratory Sessions

Dr. Ramesh N & Dr. Sathya Srikanth P Prof. Annappa C


Lab-In charge, Assoc. Prof Lab-In charge, Asst. Prof

Lab Instructor
Mrs. Divyashree H S

Dr. Arun Balodi


Dept of E&C - HOD

2
COMPUTER NETWORKS LABORATORY 2023-24

OBJECTIVES

This course will enable students to:


➢ Choose suitable tools to model a network and understand the protocols at
various OSI reference levels.
➢ Design a suitable network and simulate using a Network simulator tool.
➢ Simulate the networking concepts and protocols using C/C++
programming.
➢ Model the networks for different configurations and analyze the results.

OUTCOMES

On the completion of this laboratory course, the students will be able to:

➢ Use the network simulator for learning and practice of networking


algorithms.
➢ Illustrate the operations of network protocols and algorithms using C
programming.
➢ Simulate the network with different configurations to measure the
performance parameters.
➢ Implement the data link and routing protocols using C programming.

COURSES RELATED TO LABORATORY

1. 18EC71: COMPUTER NETWORKS

3
COMPUTER NETWORKS LABORATORY 2023-24

LIST OF EXPERIMENTS

PART-A: Simulation experiments using NS2/ NS3/ OPNET/ NCTUNS/


NetSim/QualNet/Packet Tracer or any other equivalent tool

1. Implement a point to point network with four nodes and duplex links
between them. Analyze the network performance by setting the queue size and
varying the bandwidth.

2. Implement a four node point to point network with links n0-n2, n1-n2 and
n2-n3. Apply TCP agent between n0-n3 and UDP between n1-n3. Apply
relevant applications over TCP and UDP agents changing the parameter and
determine the number of packets sent by TCP/UDP.

3. Implement Ethernet LAN using n (6-10) nodes. Compare the throughput by


changing the error rate and data rate.

4. Implement Ethernet LAN using n nodes and assign multiple traffic to the
nodes and obtain congestion window for different sources/ destinations.

5. Implement ESS with transmission nodes in Wireless LAN and obtain the
performance parameters.

6. Implementation of Link state routing algorithm.

4
COMPUTER NETWORKS LABORATORY 2023-24

PART-B: Implement the following in C/C++

1. Write a program for a HLDC frame to perform the following.

i) Bit stuffing
ii) Character stuffing.

2. Write a program for distance vector algorithm to find suitable path for
transmission.

3. Implement Dijkstra’s algorithm to compute the shortest routing path.

4. For the given data, use CRC-CCITT polynomial to obtain CRC code. Verify
the program for the cases
a. Without error
b. With error

5. Implementation of Stop and Wait Protocol and Sliding Window Protocol

6. Write a program for congestion control using leaky bucket algorithm.

5
COMPUTER NETWORKS LABORATORY 2023-24

INTRODUCTION

Communication means the transfer of information from a sender to a


receiver. It can be between human beings or computer systems. Information is
the knowledge or intelligence. The source of information can be in analog form
or in digital form. Information that has been processed, organized, and stored is
called Data. Data communications is the process of transforming digital
information between two or more points. The communications nowadays is
mostly digital due to highly reliability, operating speed, miniaturization, and
precise data handling.

This manual typically contains practical/lab sessions related to Computer


networks, implemented in Network Simulator (Packet Tracer) and C/C++ code
covering various aspects related to the subject for in depth understanding.

Network simulation is an important tool in developing, testing and


evaluating network protocols. Simulation can be used without the target
physical hardware, making it economical and practical for almost any scale of
network topology and setup. It is possible to simulate a link of any bandwidth
and delay, even if such a link is currently impossible in the real world. With
simulation, it is possible to set each simulated node to use any desired software.
This means that meaning deploying software is not an issue. Results are also
easier to obtain and analyze, because extracting information from important
points in the simulated network is as done by simply parsing the generated trace
files.

Network Simulation Experience

The Network Simulator offers a simplified and complete network simulation


experience. The following diagram depicts this functionality offered by the
Network Simulator.

6
COMPUTER NETWORKS LABORATORY 2023-24

The Network Simulator can design and simulate a network with SNMP, TL1,
TFTF, FTP, Telnet and IOS devices, in four simple steps:

1. Add devices to the Device tree: Add devices with the required configuration
to the device tree in the Network Designer. Preconfigured devices are also
bundled with the toolkit.

2. Create the Network: Create and add bulk devices to the network, at one shot.

3. Configure the Network devices: Configure the devices in the network, if


required.

4. Start the Network: Start the network or start individual agents in the network.
The MIB Browser and TL1 Craft Interface test tools, can be used as the
manager tools for testing.

Packet Tracer is a protocol simulator developed at Cisco Systems. Packet


Tracer (PT) is a powerful and dynamic tool that displays the various protocols
used in networking, in either Real Time or Simulation mode. This includes
layer 2 protocols such as Ethernet and PPP, layer 3 protocols such as IP, ICMP,
7
COMPUTER NETWORKS LABORATORY 2023-24

and ARP, and layer 4 protocols such as TCP and UDP. Routing protocols can
also be traced. Packet Tracer is a supplement to and not a replacement for
experience with real equipment. Students are encouraged to compare the results
obtained from Packet Tracer network models with the behavior of real
equipment.
Cisco® Packet Tracer is a powerful network simulation program that
allows students to experiment with network behavior and ask “what if”
questions. As an integral part of the Networking Academy comprehensive
learning experience, Packet Tracer provides simulation, visualization,
authoring, assessment, and collaboration capabilities to facilitate the teaching
and learning of complex technology concepts.

Packet Tracer helps instructors teach complex networking concepts in the


following ways:

• Provides a visual demonstration of complex technologies and configurations


• Allows instructors to author customized, guided activities that provide
immediate feedback using the Activity Wizard
• Facilitates numerous learning activities such as lectures, individual and group
lab activities, homework, assessments, games, network design, troubleshooting,
modeling tasks, case studies, and competitions
• Enables visualization, animation, and detailed modeling for exploration,
experimentation, and explanation
• Supports self-paced learning outside the classroom
• Supports social learning processes by enabling collaboration and competition

The Student Experience


STUDENTS WHO SPEND MORE TIME IN A HANDS-ON MODE OF LEARNING, WITH SIMULATION AND
INTERACTIVE CAPABILITIES, WILL BE BETTER EQUIPPED TO APPLY CONCEPTS AND
CONFIGURATION FUNDAMENTALS WHEN EXPOSED TO REAL EQUIPMENT. AS STUDENTS GAIN
PRACTICAL EXPERIENCE WITH TASKS SUCH AS CONFIGURATION AND TROUBLESHOOTING, THEY
BECOME MORE CONFIDENT IN THEIR ABILITIES. CISCO PACKET TRACER’S MULTIUSER
FUNCTIONALITY ALSO PROVIDES AN OPPORTUNITY FOR SOCIAL LEARNING, ALLOWING
STUDENTS TO COLLABORATE AND COMPETE WITH EACH OTHER AND PLAY GAMES THAT
ENHANCE THE LEARNING EXPERIENCE.

Key Features

Packet Tracer Workspaces: Cisco Packet Tracer has two workspaces—logical


and physical. The logical workspace allows users to build logical network
topologies by placing, connecting, and clustering virtual network devices. The
8
COMPUTER NETWORKS LABORATORY 2023-24

physical workspace provides a graphical physical dimension of the logical


network, giving a sense of scale and placement in how network devices such as
routers, switches, and hosts would look in a real environment. The physical
view also provides geographic representations of networks, including multiple
cities, buildings, and wiring closets.

9
COMPUTER NETWORKS LABORATORY 2023-24

EXPERIMENT -1

Aim: Implement a point to point network with four nodes and duplex links
between them. Analyze the network performance by setting the queue size and
varying the bandwidth.

Apparatus (Software): Packet Tracer Software

Procedure:

1. Develop a topology shown in the figure given below


2. Configure all the nodes
3. Configure the switch & sniffer
4. Varying the bandwidth from 100Mbps to 10Mbps in switch ports ( Fast
Ethernet 0/1 and Fast Ethernet 1/1 )
5. Analyze the network performance by setting the queue size in sniffer 0

10
COMPUTER NETWORKS LABORATORY 2023-24

11
COMPUTER NETWORKS LABORATORY 2023-24

EXPERIMENT -2

Aim: Implement a four node point to point network with links n0-n2, n1-n2 and
n2-n3. Apply TCP agent between n0-n3 and UDP between n1-n3. Apply
relevant applications over TCP and UDP agents changing the parameter and
determine the number of packets sent by TCP/UDP.

Apparatus (Software): Packet Tracer Software

Procedure:

1. Develop a topology shown in the figure given below


2. Configure all the nodes
3. Verify the continuity using ping command from node1 to Server
4. Enable the ‘HTTP’ service in Server (node 3).
5. Generate web (HTTP) traffic from node 1, the procedure is as follows
a) Switch to Simulation mode
b) Click node 1 and click the desktop tab > Web Browser
c) In the URL, enter server IP address and click Go. Envelops (TCP
PDUs) will appear in the simulation window.
d) Minimize, but do not close, the node 1 configuration window
6. Disable the ‘HTTP’ service in Server. Now enable the ‘DNS’ service in
Server. Give DNS name & IP address.

7. Generate DNS traffic from node 1, the procedure is as follows


a) Switch to Simulation mode
b) Click node 1 and click the desktop tab > Web Browser
c) In the URL, enter server IP address and click Go. Envelops (UDP
PDUs) will appear in the simulation window.
d) Minimize, but do not close, the node 1 configuration window

8. Repeat same steps for node 0, analyze the TCP/UDP packets

12
COMPUTER NETWORKS LABORATORY 2023-24

13
COMPUTER NETWORKS LABORATORY 2023-24

EXPERIMENT - 3

Aim: Implement Ethernet LAN using n (6-10) nodes. Compare the throughput
by changing the error rate and data rate.

Apparatus (Software): Packet Tracer Software

Procedure:
1. Develop a topology shown in the figure given below
2. Configure all the workstations
3. Configure the switch & Router
4. Verify the continuity using ping command
5. Compare the throughput by changing the error rate and data rate

14
COMPUTER NETWORKS LABORATORY 2023-24

EXPERIMENT - 4

Aim: Implement Ethernet LAN using n nodes and assign multiple traffic to the
nodes and obtain congestion window for different sources/ destinations.

Apparatus (Software): Packet Tracer Software / GNS3 / Wireshark

Procedure:
1. Develop a topology shown in the figure given below
2. Configure all the nodes
3. Configure the switch & Router
4. Verify the continuity using ping command
5. Verify congestion window for different sources / destinations

15
COMPUTER NETWORKS LABORATORY 2023-24

EXPERIMENT - 5

Aim: Implement ESS with transmission nodes in Wireless LAN and obtain the
performance parameters.

Apparatus (Software): Packet Tracer Software

Procedure:

1. Develop a topology shown in the figure given below


2. Configure access points AP1 & AP2 with different SSID names. port
status should be turned on
3. Connect a hosts and two WLAN access points to a router
4. Setup nodes around the two WLAN access points and set the path for
each node

5. Verify the 802.11 wireless parameters in simulation mode

16
COMPUTER NETWORKS LABORATORY 2023-24

17
COMPUTER NETWORKS LABORATORY 2023-24

EXPERIMENT - 6

Aim: Implementation of Link state routing algorithm.

Apparatus (Software): Packet Tracer Software

Procedure:

1. Develop a topology shown in the figure given below


2. Configure all the workstations
3. Configure all switches
4. Configure all Routers
5. Implement OSPF protocols in Router to configure network

18
COMPUTER NETWORKS LABORATORY 2023-24

PART-B: Implement the following in C/C++

EXPERIMENT NO-01
i) Bit stuffing and De-stuffing

Aim: To write a C program to simulate bit stuffing using HDLC.

Algorithm:

Step1: input the data sequence


Step2: add start to frame to output sequence
Step3: for every bit in input append bit to output sequence
Step4: increment the count if bit is a 1
Step5: if count is 5 append 0 to output sequence and reset count else set count
to 0
Step6: add stop bits to frame to output sequence

//Bit stuffing & destuffing

#include<stdio.h>
#include<conio.h>
#include<string.h>
#define max 1000
#if 0
void main()
{
int si=0, di=0,count=0;
char src[max],des[max];
char flag[max]="01111110";
clrscr();
printf("enter the msg bits:\n");
scanf("%s",&src);
di = strlen(flag) ;
strcpy(des,flag);
di=strlen(flag);
while(src[si]!='\0')
{
if(src[si]=='1')
count ++;
else
count = 0;
des[di++]=src[si++];
if (count == 5)
19
COMPUTER NETWORKS LABORATORY 2023-24

{
count = 0;
des[di++]='0';
}
}
des[di++]='\0';
printf("stuffed message is %s ", strcat(des,flag));
si = strlen(flag);
for(di=0;si<strlen(des)-2*si-1;si++,di++)
src[di]=des[si];
count = 0;
si = 0; di =0;
while (src[si]!='\0')
{
if(src[si]=='1')
count++;
else
count = 0;
des[di++]=src[si++];
if(count==5)
{
count = 0;
des[di++]=src[si++];
}
}
des[di]='\0';
printf("destuffed data is %s" , des);
getch();
}
#else
void main()
{
int si=0, di=0,count=0,StuffedLen;
char src[max],des[max];
char flag[max]="01111110";

clrscr();
printf("enter the msg bits:\n");
scanf("%s",&src);
di = strlen(flag) ;
strcpy(des,flag);
di=strlen(flag);
while(src[si]!='\0')
{
if(src[si]=='1')
count ++;
else
count = 0;
des[di++]=src[si++];
20
COMPUTER NETWORKS LABORATORY 2023-24

if (count == 5)
{
count = 0;
des[di++]='0';
}
}
des[di++]='\0';
printf("stuffed message is %s ", strcat(des,flag));
si = strlen(flag);
StuffedLen = strlen(des)-2*si;
for(di=0;di<StuffedLen;si++,di++)
src[di]=des[si];
src[di] = '\0';
count = 0;
si = 0; di =0;
while (src[si]!='\0')
{
if(src[si]=='1')
count++;
else
count = 0;
des[di++]=src[si++];
if(count==5)
{
count = 0;
si++;
//des[di++]=src[si++];
}
}
des[di]='\0';
printf("The destuffed data is %s" , des);
getch();
}

Output

Enter the msg bits 01111111


Stuffed message is 0111111001111101101111110
Destuffed msg is 01111111

21
COMPUTER NETWORKS LABORATORY 2023-24

EXPERIMENT NO-01
ii) Character Stuffing And De-Stuffing

Aim: To write a C program to simulate character stuffing and De-stuffing using


HDLC.

Theory:
Bit stuffing seems to be a foolproof plan but sometimes the communication
systems cannot handled bits but only manipulate bytes(8 bits). In these case we assume an
ASCII set. The main control signals are ETX (End text), STX (Start text), and DLE (data link
escape). Other control signals are also present like SOH (Start of header), EOT (End of
transmission), etc but we will restrict the the discussion to ETX STX DLE .The principle
remains the same STX (ASCII 02) denots start of data and ETX (ASCII 03) the end of text
.incase ETX or the byte 03 happens to be present in data and not end of the text.

Similar is the case for STX. to making sure this happens we use another ASCII
value called DLE (ASCII 16). Each time we see the STX in data we make it DLE STX and
an ETX is made into DLE ETX. So if we receive an ETX or a STX and the previous ASCII
value is not DLE we know it is a frame start/end. Consider the case when DLE was the last
data byte. Then end of the text will now become as data as the receiver will get DLE ETX.
So now even DLE is stuffed. So each time transmitter sees DLE it makes it DLE DLE.

ALGORITHM:

Step1: input the data sequence


Step2: add start to frame to output sequence (DLE STX)
Step3: for every character in input append character to output sequence
Step4: if character is DLE and DLE to the output sequence
Step4: Add stop of frame chars(DLE ETX) to the output sequence.

// character stuffing
#include<stdio.h>
#include<conio.h>
#include<string.h>
#define max 100
void main()

{
clrscr();
int si=0, di =0;
char flag1[max]="DLESTX", flag2[max]="DLEETX", des[max], src[max];

printf("enter the string data:\n");


scanf("%s",&src);
22
COMPUTER NETWORKS LABORATORY 2023-24

/*stuffing process*/
strcpy(des,flag1);
di=strlen(flag1);
while(src[si]!='\0')
{
if(src[si]=='D'&& src[si+1]=='L'&& src[si+2]=='E')
{
des[di+0]='D', des[di+1]='L', des[di+2]='E',
des[di+3]='D', des[di+4]='L', des[di+5]='E';
di+=6;
si+=3;
}
else
des[di++]=src[si++];
}
des[di]='\0';
strcat(des,flag2);
printf("\nthe stuffed string is %s\n",des);

/*destuffing process*/

di = strlen(des)-strlen(flag2);
des[di]='\0';
di=strlen(flag1);
for(si=0;des[di]!='\0';si++,di++)
src[si]=des[di];
si=di=0;
while(src[si]!='\0')
{
if(src[si]=='D'&&src[si+1]=='L'&&src[si+2]=='E'&&
src[si+3]=='D'&&src[si+4]=='L'&&src[si+5]=='E')
{
des[di]='D',des[di+1]='L',des[di+2]='E';
di+=3;
si+=6;
}
else
des[di++]=src[si++];
}
des[di]='\0';
printf("the destuffed string is %s",des);
getch();
}

23
COMPUTER NETWORKS LABORATORY 2023-24

OUTPUT:

1. Enter the string data ABCDLE


The Stuffied string is DLE STX ABCDLE DLE DLE ETX
Destuffed string is ABCDLE

2. Enter the string data ABCDEFGH


The Stuffied string is DLESTX ABCDEFGH DLE ETX
Destuffed string is ABCDEFGH

24
COMPUTER NETWORKS LABORATORY 2023-24

EXPERIMENT NO-02
DISTANCE VECTOR ALGORITHM

Aim: Write a program for distance vector algorithm to find suitable path for
transmission.

Theory:

One of the most popular & dynamic routing algorithms, the distance
vector routing algorithms operate by using the concept of each router having to
maintain a table( ie., a vector ), that lets the router know the best or shortest
distance to each destination and the next hop to get to there. Also known as
Bellman Ford(1957) and Ford Fulkerson (1962). It was the original ARPANET
algorithm.

Algorithm Overview:

Each router maintains a table containing entries for and indexed by each
other router in the subnet. Table contains two parts:

1. A preferred outing line.


2. Estimate of time or distance to that destination.

The metric used here is the transmission delay to each destination. This metric
maybe number of hops, queue length, etc.

The router is assumed to know the distance metric to each of its neighbors.
Across the network the delay is calculated by sending echo packets to each of
neighbors.

PROGRAM :

#include<stdio.h>
#include<string.h>
#include<conio.h>

struct rtable
{
int dist[20],nextnode[20];
}table[20];

25
COMPUTER NETWORKS LABORATORY 2023-24

int cost[10][10],n;
void distvector()
{
int i,j,k,count=0;
for(i=0;i<n;i++)
{
for(j=0;j<n;j++)
{
table[i].dist[j]=cost[i][j];
table[i].nextnode[j]=j;
}
}
do
{
count=0;
for(i=0;i<n;i++)
{
for(j=0;j<n;j++)
{
for(k=0;k<n;k++)
{
if(table[i].dist[j]>cost[i][k]+table[k].dist[j])
{
table[i].dist[j]=table[i].dist[k]+table[k].dist[j];
table[i].nextnode[j]=k;
count++;
}
}
}
}

}while(count!=0);
}

void main()
{
int i,j;
printf("\nenter the no of vertices:\t");
scanf("%d",&n);
printf("\nenter the cost matrix\n");
for(i=0;i<n;i++)
for(j=0;j<n;j++)
scanf("%d",&cost[i][j]);
distvector();
for(i=0;i<n;i++)
{
printf("\nstate value for router %c \n",i+65);
printf("\ndestnode\tnextnode\tdistance\n");
for(j=0;j<n;j++)
26
COMPUTER NETWORKS LABORATORY 2023-24

{
if(table[i].dist[j]==99)
printf("%c\t\t-\t\tinfinite\n",j+65);
else

printf("%c\t\t%c\t\t%d\n",j+65,table[i].nextnode[j]+65,table[i].dist[j]);
}

%%return 0;

getch(),
}
}

OUTPUT :

enter the no of vertices: 6


enter the cost matrix

0 2 1 99 99 1
2 0 99 2 1 99
1 99 0 99 2 2
99 2 99 0 1 5
99 1 2 1 0 99
1 99 2 5 99 0

state value for router A

destnode nextnode distance


A A 0
B B 2
C C 1
D B 4
E B 3
F F 1

state value for router B

destnode nextnode distance


A A 2
B B 0
C A 3
D D 2
E E 1
F A 3
state value for router C

destnode nextnode distance


27
COMPUTER NETWORKS LABORATORY 2023-24

A A 1
B A 3
C C 0
D E 3
E E 2
F F 2

state value for router D


destnode nextnode distance
A B 4
B B 2
C E 3
D D 0
E E 1
F F 5

state value for router E


destnode nextnode distance
A B 3
B B 1
C C 2
D D 1
E E 0
F B 4

state value for router F


destnode nextnode distance
A A 1
B A 3
C C 2
D D 5
E A 4
F F 0

28
COMPUTER NETWORKS LABORATORY 2023-24

EXPERIMENT NO-03
Shortest Path Algorithm

Aim: To write a C program to simulate Shortest Path Algorithm.

Theory:

All packet need to be routed from the source to the destination and in
most cases multiple hopes are required. Routing Algorithms are required to
decide on which output line and incoming pocket should be forwarded into.

Two types Routing Algorithms now come in-one where the decision
is fixed and One where the route is constantly recalculated for the best route in
other words static and dynamic routing algorithms or non-adaptive and adaptive
algorithms. Routing algorithms can be made to adapt to average
traffic/loss/distance queue length etc.

Dijkstra’s method of computing the shortest path is a static routing


algorithm. It involves building a graph of the subnet, with each node of the
graph representing a router and each are representing a communication line or a
link. to find a route between a pairs of routers the algorithm just find the
shortest path between the them on the graph. In Dijkstra’s algorithms the metric
used for calculation is distance. Each node is labled with its distance from the
source node along with the previous node in the path. initially no paths are
known so all nodes are labled with infinity. As the algorithm proceeds and
paths are found, the labels may change reflecting better paths.

A label may be either tentative or permanent. Initially all nodes are


tentative and once it is discovered that the shortest possible path to a node is got
it is made permanent and never changed after that.

29
COMPUTER NETWORKS LABORATORY 2023-24

ALGORITHM:

➢ Input graph data


➢ Make all the nodes TENTATIVE
➢ Input source, destination
➢ Make source the working node
➢ Make the working node PARMANENT
➢ Check all the tentative node which are connected to working node
update weight if required.
➢ Find TENTATIVE with smallest weight. Make this the new
working node
➢ If node is destination go to the step 8 else go to the step 4
➢ Trace back from destination to source.

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

int p[10][10];
void main()
{
int i,j,k,n,t; int m[10][10], w[10][10];
void path(int a,int b);
clrscr();
printf("enter the number of nodes");
scanf ("%d",&n);
printf("\n Enter the nodes connection matrix");
printf("\n To indicate no connection between two nodes, enter weight as 100\n\n");
/* prints the outline of the matrix */
for(i=1;i<=n;i++)
printf("\t %d",i);
for(i=1;i<=n;i++)
{
printf("\n %d \t",i);
/* Takes the entered values as input */
for( j=1;j<=n;j++)
{
scanf("%d",&w[i][j]);
m[i][j]=w[i][j];
p[i][j]=0;
}
}
for(k=1;k<=n;k++)
for(i=1;i<=n;i++)
for(j=1;j<=n;j++)
30
COMPUTER NETWORKS LABORATORY 2023-24

if(m[i][k]+m[k][j]<m[i][j])
{
m[i][j] =m[i][k] + m[k][j];
p[i][j] = k;
}
do
{
printf("\n enter the source & Destination nodes\n");
scanf("%d %d",&i,&j);
printf("\n the weight is %d", m[i][j]);
printf("\n the path is");
printf( "%d-->",i);
path(i,j);
printf("%d", j);
printf("\n to repeat press R");
}

while(getch()=='R');
}
void path(int i,int j)
{
int k;
k=p[i][j];
if(k!=0)
{
path(i,k);
printf("%d-->",k);
path(k,j);
} }

OUTPUT:

Enter no of nodes 7
31
COMPUTER NETWORKS LABORATORY 2023-24

Enter the source and destination nodes


1
7
The weight is 7
The path is 1→3→5→7
To repeat press R

32
COMPUTER NETWORKS LABORATORY 2023-24

EXPERIMENT NO-04
Cyclic Redundancy Check

AIM: To write a C program to compute polynomial code checksum for CRC-


CCITT.

THEORY:
The polynomial code (also known as a Cyclic Redundancy code or CRC code)
is widely used. polynomial codes are based upon treating bit string as representations of
polynomials with coefficients of 0 and 1 only. A k-bit frame is regarded as the coefficient list
for a polynomial with k terms, ranging from x k-1 to x0. Such a polynomial is said to be of a
degree k-1. The high order (left most) bit is the coefficient of x k-1; the next bit is the
coefficient of x k-2 and so on. For example 110001 has 6 bits and thus represents a six-term
polynomial with coefficients.1,1,0,0,0 and 1: x5+x4+x0.

When the polynomial code method is employed, the centre and receiver must agree upon a
generator polynomial, G(x) in advanced, both the high and low order bits of the generator
must be one. To compute the checksum for some frame with m bits, corresponding to the
polynomial M(x) the frame must be longer than the generator polynomial. the idea is so to
append a checksum to the end of the frame in such a way that the polynomial represented by
the check summed frame is divisible by G(x).When the receiver gets the check summed
frame, it tries dividing it by G(x).If there is a remember there has been a transmission error.

ALGORITHM:

➢ Let r be the degree of G(x). Append r zero bits to the low order end of the frame, so it now
contains m+r bits and corresponds to the polynomial xr M(x).
➢ Divide the bits string corresponding to G(x) into the bit string corresponding to xr M(x)
using modulo-2 division.
➢ Subtract the remainder(which is always r or fewer bits) from the bit string corresponding to
xr M(x) using modulo-2 subtraction. The result is the checksummed frame to be transmitted.
Call its polynomial T(x).
➢ The CRC- CCITT polynomial is X3+ X1 + 1

#include<stdio.h>
#include<conio.h>
#include<string.h>
#define degree 3
int res[30];
int getnext(int array[],int);
void crc(int len)
{
int cp[]={1,0,1,1};
int i=0,pos=0,newpos;
33
COMPUTER NETWORKS LABORATORY 2023-24

while(pos<len-degree)
{
for(i= pos;i<pos+degree+1;++i)
res[i]=res[i]^cp[i-pos];
newpos=getnext(res,pos);

if(newpos>pos+1)
pos= newpos-1;
++pos;
}
}
int getnext(int array[], int pos)
{
int i = pos;
while( array[i] ==0)
++i;
return i;
}
void main()
{
int array[30];
char ch;
int len,i=0;
clrscr();
puts("enter the data stream:");
while((ch =getche())!='\r')
array[i++] = ch-'0';
len=i;
for(i=0;i<degree; ++i)
array[i+len]=0;
len+= degree;
for(i=0;i<len;i++)
res[i]=array[i];
crc(len);
printf("\n the transmitted frame is: ");
for(i=0; i<len-degree; ++i)
printf("%d", array[i]);
for(i=len-degree; i<len;++i)
printf("%d", res[i]);
printf("\nEnter the stream for which crc to be checked");
i=0;
while((ch=getche())!='\r')
array[i++]= ch-'0';
len=i;
for(i=0;i<len;i++)
res[i]=array[i];
crc(len);
printf("\n checksum: ");
for(i=len-degree; i<len;i++)
printf("%d", res[i]);
getch();
}
OUTPUT:

34
COMPUTER NETWORKS LABORATORY 2023-24

(Without error)
Enter data stream 10011
Transmitted frame is 10011100
Enter the stream for which CRC to be checked 10011100
Checksum: 000
(With error)
Enter data stream 10011
Transmitted frame is 10011100
Enter the stream for which crc to be checked 10011101
Checksum: 001

35
COMPUTER NETWORKS LABORATORY 2023-24

EXPERIMENT NO – 5

Stop and Wait Protocol and Sliding Window Protocol

AIM: Implementation of Stop and Wait Protocol and Sliding Window Protocol

THEORY:

In computer networks sliding window protocol is a method to transmit data on a


network. Stop and wait protocol and Sliding window protocol are applied on the Data Link
Layer of OSI model. At data link layer data is in the form of frames. In Networking, Window
simply means a buffer which has data frames that needs to be transmitted.

Flow Control
Consider a situation in which the sender transmits frames faster than the receiver can accept
them. If the sender keeps pumping out frames at high rate, at some point the receiver will be
completely swamped and will start losing some frames. This problem may be solved by
introducing flow control. Most flow control protocols contain a feedback mechanism to
inform the sender when it should transmit the next frame.

Mechanisms For Flow Control:

• Stop and Wait Protocol: This is the simplest file control protocol in which the
sender transmits a frame and then waits for an acknowledgement, either positive or
negative, from the receiver before proceeding. If a positive acknowledgement is
received, the sender transmits the next packet; else it retransmits the same frame.
However, this protocol has one major flaw in it. If a packet or an acknowledgement is
completely destroyed in transit due to a noise burst, a deadlock will occur because the
sender cannot proceed until it receives an acknowledgement. This problem may be
solved using timers on the sender's side. When the frame is transmitted, the timer is
set. If there is no response from the receiver within a certain time interval, the timer
goes off and the frame may be retransmitted.

36
COMPUTER NETWORKS LABORATORY 2023-24

Stop and Wait Protocol

Step 1: Start the Program


Step 2: Generate a random that gives the total number of frames to be
transmitted
Step 3: Transmit the first frame
Step 4: receive the acknowledgement for the first frame
Step 5: Transmit the next frame
Step 6: Find the remaining frames to be sent

37
COMPUTER NETWORKS LABORATORY 2023-24

Step 7: If the acknowledgment is not received for a particular frame retransmit


that frame alone again
Step 8: Repeat the step 5 to 7 till the number of remaining frames to be send
becomes zero
Step 9: Stop the Program

#include<stdio.h>
#include<conio.h>
#include<stdlib.h>

Void main()
{
int i,j,noframes,x,x1=10,x2;
clrscr();
for(i=0;i<200;i++)
rand();
noframes=rand()/200;
i=1;j=1;
noframes=noframes/8;
printf(“\n Number of frames is %d”,noframes);
getch();
while(noframes>0)

38
COMPUTER NETWORKS LABORATORY 2023-24

{
printf(“\n Sending frames %d”,i);
strand(x1++);
x=rand()%10;
if(x%2==0)
{
for(x2=1;x2<2;x2++)
{
Printf(“Waiting for %d seconds \n”,x2);
sleep(x2);
}
printf(“\n sending frame %d”,i);
strand(x1++);
x=rand()%10;
}
printf(“\n ack for frame %d”.j);
noframes-=1;
i++;j++;
}
printf(“\n end of stop and wait protocol”);
getch();
}

• Sliding Window Protocols: In spite of the use of timers, the stop and wait protocol
still suffers from a few drawbacks. Firstly, if the receiver had the capacity to accept
more than one frame, its resources are being underutilized. Secondly, if the receiver
was busy and did not wish to receive any more packets, it may delay the
acknowledgement. However, the timer on the sender's side may go off and cause an
unnecessary retransmission. These drawbacks are overcome by the sliding window
protocols.
In sliding window protocols the sender's data link layer maintains a 'sending window'
which consists of a set of sequence numbers corresponding to the frames it is
permitted to send. Similarly, the receiver maintains a 'receiving window'
corresponding to the set of frames it is permitted to accept. The window size is
dependent on the retransmission policy and it may differ in values for the receiver's
and the sender's window. The sequence numbers within the sender's window
represent the frames sent but as yet not acknowledged. Whenever a new packet
arrives from the network layer, the upper edge of the window is advanced by one.
When an acknowledgement arrives from the receiver the lower edge is advanced by
one. The receiver's window corresponds to the frames that the receiver's data link
layer may accept. When a frame with sequence number equal to the lower edge of the
window is received, it is passed to the network layer, an acknowledgement is
generated and the window is rotated by one. If however, a frame falling outside the
window is received, the receiver's data link layer has two options. It may either
discard this frame and all subsequent frames until the desired frame is received or it

39
COMPUTER NETWORKS LABORATORY 2023-24

may accept these frames or buffer them until the appropriate frame is received and
then pass the frames to the network layer in sequence.

Sliding window works in full duplex mode

It is of two types:-

1. Selective Repeat: Sender transmits only that frame which is erroneous or is lost.

2. Go back n: Sender transmits all frames present in the window that occurs after the error
bit including error bit also.

Sliding Window Protocol Programme:

#include<stdio.h>

int main()
{
int w,i,f,frames[50];

40
COMPUTER NETWORKS LABORATORY 2023-24

printf("Enter window size: ");


scanf("%d",&w);

printf("\nEnter number of frames to transmit: ");


scanf("%d",&f);

printf("\nEnter %d frames: ",f);

for(i=1;i<=f;i++)
scanf("%d",&frames[i]);

printf("\nWith sliding window protocol the frames will be sent in the following manner
(assuming no corruption of frames)\n\n");
printf("After sending %d frames at each stage sender waits for acknowledgement sent by the
receiver\n\n",w);

for(i=1;i<=f;i++)
{
if(i%w==0)
{
printf("%d\n",frames[i]);
printf("Acknowledgement of above frames sent is received by sender\n\n");
}
else
printf("%d ",frames[i]);
}

if(f%w!=0)
printf("\nAcknowledgement of above frames sent is received by sender\n");

return 0;
}

Output

Enter window size: 3

Enter number of frames to transmit: 5

Enter 5 frames: 12 5 89 4 6

With sliding window protocol the frames will be sent in the following manner (assuming no
corruption of frames)

After sending 3 frames at each stage sender waits for acknowledgement sent by the receiver

12 5 89
Acknowledgement of above frames sent is received by sender

41
COMPUTER NETWORKS LABORATORY 2023-24

46
Acknowledgement of above frames sent is received by sender

42
COMPUTER NETWORKS LABORATORY 2023-24

EXPERIMENT NO – 6

6. Write a program for Congestion control using the leaky bucket algorithm.

LEAKY BUCKET ALGORITHM

The leaky-bucket implementation is used to control the rate at which traffic is sent to
the network. A leaky bucket provides a mechanism by which bursty traffic can be shaped to
present a steady stream of traffic to the network, as opposed to traffic with erratic bursts of
low-volume and high-volume flows.

Traffic analogy An appropriate analogy for the leaky bucket is a scenario in which
four lanes of automobile traffic converge into a single lane. A regulated admission interval
into the single lane of traffic flow helps the traffic move. The benefit of this approach is that
traffic flow into the major arteries (the network) is predictable and controlled. The major
liability is that when the volume of traffic is vastly greater than the bucket size, in
conjunction with the drainage-time interval, traffic backs up in the bucket beyond bucket
capacity and is discarded.

● The Leaky-bucket algorithm

The algorithm can be conceptually understood as follows:


● Arriving packets (network layer PDUs) are placed in a bucket with a hole in the
bottom.
● The bucket can queue at most b bytes. If a packet arrives when the bucket is full, the
packet is discarded.
● Packets drain through the hole in the bucket, into the network, at a constant rate of r
bytes per second, thus smoothing traffic bursts.
The size b of the bucket is limited by the available memory of the system.
Sometimes the leaky bucket and token algorithms are lumped together under the same name.

43
COMPUTER NETWORKS LABORATORY 2023-24

PROGRAM :

#include<stdio.h>
#include<stdlib.h>
int trand(int a)
{
int rn;
rn=random()%10;
rn=rn%a;
if(rn==0)
rn=1;
return(rn);
}

int main()
{
int i,packet[5],psz,bsz,pszrn=0,clk,ptime,premain,orate,flag=0;
for(i=0;i<5;i++)
packet[i]=trand(6)*10;
printf("\nenter the o/p rate");
scanf("%d",&orate);
printf("\nenter the bucket size");
scanf("%d",&bsz);
for(i=0;i<5;i++)
{
if((packet[i]+pszrn)>bsz)
printf("\n incoming packet size %d is greater than bucket
size_reject",packet[i]);
else
{
for(;;)
{
premain=4-i;
psz=packet[i];
pszrn+=psz;
printf("\nincoming packet size is %d",psz);
printf("\n no.of packets waiting for transmission= %d",pszrn);
ptime=trand(4)*10;
printf("\nnext packet will come at %d",ptime);
for(clk=0;clk<=ptime;clk++)
{
printf("\ntime left =%d",ptime-clk);
sleep(1);
if(pszrn)
{
if(pszrn==0)
printf("\nbucket is empty");
else
{
44
COMPUTER NETWORKS LABORATORY 2023-24

if(pszrn>=orate)
printf("%d bytes are tranmited",orate);
else
printf("\n %d bytes are
transmitted",pszrn);
}
if(pszrn<=orate)
pszrn=0;
else
pszrn-=orate;
printf("\nbytes remaining %d ",pszrn);
}
else
printf("\nbytes remaing %d ",pszrn);
}
if(pszrn!=0)
flag=1;
break;
}
}
}
printf("\n\n");
return 0;
}

OUTPUT : RUN 1:

enter the o/p rate10


enter the bucket size5

incoming packet size 30 is greater than bucket size_reject


incoming packet size 10 is greater than bucket size_reject
incoming packet size 10 is greater than bucket size_reject
incoming packet size 50 is greater than bucket size_reject
incoming packet size 30 is greater than bucket size_reject

RUN 2:

enter the o/p rate5


enter the bucket size10

incoming packet size 30 is greater than bucket size_reject


incoming packet size is 10
no.of packets waiting for transmission= 10
next packet will come at 10
time left =105 bytes are tranmited
bytes remaining 5
45
COMPUTER NETWORKS LABORATORY 2023-24

time left =95 bytes are tranmited


bytes remaining 0
time left =8
bytes remaing 0
time left =7
bytes remaing 0
time left =6
bytes remaing 0
time left =5
bytes remaing 0
time left =4
bytes remaing 0
time left =3
bytes remaing 0
time left =2
bytes remaing 0
time left =1
bytes remaing 0
time left =0
bytes remaing 0
incoming packet size is 10
no.of packets waiting for transmission= 10
next packet will come at 20
time left =205 bytes are tranmited
bytes remaining 5
time left =195 bytes are tranmited
bytes remaining 0
time left =18
bytes remaing 0
time left =17
bytes remaing 0
time left =16
bytes remaing 0
time left =15
bytes remaing 0
time left =14
bytes remaing 0
time left =13
bytes remaing 0
time left =12
bytes remaing 0
time left =11
bytes remaing 0
time left =10
bytes remaing 0
time left =9
bytes remaing 0
time left =8
bytes remaing 0
46
COMPUTER NETWORKS LABORATORY 2023-24

time left =7
bytes remaing 0
time left =6
bytes remaing 0
time left =5
bytes remaing 0
time left =4
bytes remaing 0
time left =3
bytes remaing 0
time left =2
bytes remaing 0
time left =1
bytes remaing 0
time left =0
bytes remaing 0
incoming packet size 50 is greater than bucket size_reject
incoming packet size 30 is greater than bucket size_reject

47
COMPUTER NETWORKS LABORATORY 2023-24

Viva Questions
1.What do you mean by data communication?
Ans: It is the exchange of data between two devices via some form of transmission medium
such as wire cable. The communicating system must be part of a communication system
made up of a combination of hardware and software. The effectiveness of a data
communication system depends on three fundamental characteristics: delivery, accuracy and
timeliness.

2.What is simplex?
Ans: It is the mode of communication between two devices in which flow of data is
unidirectional. i.e. one can transmit and other can receive. E.g. keyboard and monitor.

3.What is half-duplex?
Ans: It is the mode of communication between two devices in which flow of data is bi-
directional but not at the same time. ie each station can transmit and receive but not at the
same time. E.g walkie-talkies are half-duplex system.

4.What is full duplex?


Ans: It is the mode of communication between two devices in which flow of data is bi-
directional and it occurs simultaneously. Here signals going in either direction share the
capacity of the link. E.g. telephone

5.What is a network?
Ans: It is a set of devices connected by communication links. A node can be a computer or
any other device capable of sending and/or receiving data generated by other nodes on the
network.

6.What is distributed processing?


Ans: It is a strategy in which services provided by the network reside at multiple sites.

7.What is point to point connection?


Ans:It provides a dedicated link between two devices. The entire capacity of the link is
reserved for transmission between the two devices e.g. when we change the TV channels by
remote control we establish a point to point connection between remote control and TV
control system.

8.What is multipoint connection?


Ans: In multipoint connection more than two specific devices share a single link. Here the
capacity of the channel is shared either separately or temporally.

9.What is a topology?
Ans: Topology of a network is defined as the geometric representation of the relationship of
all the links and linking devices (node) to one another.Four basic topologies are star, bus,
ring and mesh. Star – Here each device has a dedicated point to point link only to a central
controller called hub.Bus -It is multipoint. One long cable acts as a backbone to link all the
devices in the network. Ring -Here each device has a dedicated point to point connection
only with the two devices on either side of it. Mesh -Here every device has a dedicated point
to point link to every other device.
48
COMPUTER NETWORKS LABORATORY 2023-24

10.Define LAN, MAN and WAN.


Ans: LAN- A local area network (LAN) is a privately owned and links the devices in a
single office, building or campus. It allows resources to be shared between personal
computers and work stations. MAN- A metropolitan-area network (MAN) spreads over an
entire city. It may be wholly owned and operated by a private company, eg local telephone
company. WAN – A wide area network (WAN) provides long distance transmission of data,
voice, image and video information over large geographic areas that comprise a country, a
continent or even whole world.

11.Define internet?
Ans: It is a network of networks.

12.What is a protocol?
Ans: It is a set of rules that governs data communication. A protocol defines what is
communicated, how it is communicated, and when it is communicated. The key elements of
protocol are syntax, semantics and timing.

13.What is TCP/IP protocol model?


Ans: It is a five layered model which provides guidelines for the development of universally
compatible networking protocols. The five layers are physical, data link, network, transport
and application.

14.Describe the functions of five layers?


Ans: Physical- It transmits raw bits over a medium. It provides mechanical and electrical
specification. Data link- It organizes bits into frames. It provides hop to hop delivery.
Network-It moves the packets from source to destination.It provide internetworking.
Transport-It provides reliable process to process message delivery and error recovery.
Application-It allows ti access to network resources.

15.What is ISO-OSI model?


Ans: Open Systems Interconnection or OSI model was designed by the International
Organization for Standardization (ISO) .It is a seven layer model. It is a theoretical model
designed to show how a protocol stack should be implemented. It defines two extra layers in
addition to TCP/IP model. Session -It was designed to establish, maintain, and synchronize
the interaction between communicating system. Presentation-It was designed to handle the
syntax and semantics of the information exchanged between the two systems. It was designed
for data translation, encryption, decryption, and compression.
16. What is multiplexing?
Ans: Multiplexing is the process of dividing a link, the phycal medium, into logical channels
for better efficiency. Here medium is not changed but it has several channels instead of one.

17.What is switching?
Ans: Switching in data communication is of three types Circuit switching Packet switching
Message switching

18.How data is transmitted over a medium?


Ans: Data is transmitted in the form of electromagnetic signals.

49
COMPUTER NETWORKS LABORATORY 2023-24

19. Compare analog and digital signals? Ans: Analog signals can have an infinite number
of values in a range but digital signal can have only a limited number of values.

20.Define bandwidth?
Ans: The range of frequencies that a medium can pass is called bandwidth. It is the
difference between the highest and lowest frequencies that the medium can satisfactorily
pass.

21.What are the factors on which data rate depends?


Ans: Data rate ie.how fast we can send data depends upon i) Bandwidth available ii) The
levels of signals we can use iii) The quality of the channel (level of noise)

22.Define bit rate and bit interval?


Ans: Digital signals are aperiodic.so instead of using period and frequency we use bit
interval and bit rate respectively.Bit interval is the time required to send one single bit.Bit
rate is the number of bit intervals per second.

23.What is Nyquist bit rate formula?


Ans: For a noiseless channel, the Nyquist bit rate formula defines the theoretical maximum
bit rate Bitrate=2* Bandwidth*log2L Where Bandwidth is the bandwidth of the channel L is
the number of signal level used to represent the data Bitrate is the bit rate in bits per second.

24.Define Shannon Capacity?


Ans: Shannon Capacity determines the theoretical highest data rate foe a noise channel.
Capacity= Bandwidth * log2 (1+SNR) Bandwidth is the bandwidth of the channel. SNR is
the signal to noise ratio, it is the statical ratio of the power of the signal to the power of the
noise. Capacity is the capacity of the channel in bits per second
25.What is sampling? Ans: It is the process of obtaining amplitude of a signal at regular
intervals.
26.Define pulse amplitude modulation? Ans: It is an analog to digital conversion method
which takes analog signals, samples it and generates a series of pulse based on the results of
the sampling. It is not used in data communication because the series of pulses generated still
of any amplitude. To modify it we use pulse code modulation.
27.Define pulse code modulation? Ans: Pulse code Modulation modifies pulses created by
PAM to create a completely digital signal. For this PCM first quantizes the PAM pulse.
Quantization is the method of assigning integral values in a specific tange to sampled
instances.PCM is made up of four separate processes: PAM, quantization, binary encoding
and line encoding.
28.What is Nyquist Theorem? Ans: According to this theorem, the sampling rate must be at
least 2 times the highest frequency of the original signal.
29.What are the modes of data transmission? Ans: Data transmission can be serial or
parallel in mode In parallel transmission, a group of bits is sent simultaneously, with each bit
on a separate line.In serial transmission there is only one line and the bits are sent
sequentially.
30.What is Asynchronous mode of data transmission? Ans: It is a serial mode of
transmission. In this mode of transmission, each byte is framed with a start bit and a stop bit.
There may be a variable length gap between each byte.
31.What is Synchronous mode of data transmission? Ans: It is a serial mode of
transmission.In this mode of transmission, bits are sent in a continuous stream without start
50
COMPUTER NETWORKS LABORATORY 2023-24

and stop bit and without gaps between bytes. Regrouping the bits into meaningful bytes is the
responsibility of the receiver.
32.What are the different types of multiplexing? Ans: Multiplexing is of three types.
Frequency division multiplexing and wave division multiplexing is for analog signals and
time division multiplexing is for digital signals.
33.What is FDM? Ans: In frequency division multiplexing each signal modulates a different
carrier frequency. The modulated carrier combines to form a new signal that is then sent
across the link. Here multiplexers modulate and combine the signal while demultiplexers
decompose and demodulate. Guard bands keep the modulating signal from overlapping and
interfering with one another.
34.What is TDM ? Ans: In TDM digital signals from n devices are interleaved with one
another, forming a frame of data. Framing bits allow the TDM multiplexer to synchronize
properly.
35.What are the different transmission media? Ans: The transmission media is broadly
categorized into two types i)Guided media(wired) i)Unguided media(wireless)
36.What are the different Guided Media? Ans: The media which provides a conduct from
one device to another is called a guided media. These include twisted pair cable, coaxial
cable, and fiber-optic cable.
37.Describe about the different Guided Medias. Ans: Twisted pair cable consists of two
insulated cupper wires twisted together. It is used in telephone line for voice and data
communications. Coaxial cable has the following layers: a metallic rod-shaped inner
conductor, an insulator covering the rod, a metallic outer conductor (shield), an insulator
covering the shield, and a plastic cover.Coaxial cable can carry signals of higher frequency
ranges than twisted-pair cable. Coaxial cable is used in cable TV networks and Ethernet
LANs.Fiber-optic cables are composed of a glass or plastic inner core surrounded by
cladding, all encased in an outer jacket.Fiber-optic cables carry data signals in the form of
light. The signal is propagated along the inner core by reflection. Its features are noise
resistance, low attenuation, and high bandwidth capabilities. It is used in backbone networks,
cable TV nerworks, and fast Ethernet networks.
38.What do you mean by wireless communication? Ans: Unguided media transport
electromagnetic waves without using a physical conductor. This type of communication is
referred as wireless communication. Here signals are broadcaster through air and thus
available to anyone who has a device to receive it. are connected to one another efficiently. A
switch is intermediary hardware or software that links devices together temporarily.
39.What are the switching methods? Ans: There are three fundamental switching methods:
circuit switching, packet switching, And message switching.In circuit switching, a direct
physical connection between two devices is created by space division switches, time division
switches or both. In packet switching data is transmitted using a packet switched network.
Packet switched network is a network in which data are transmitted in independent units
called packets.
40.What are the duties of data link layer? Ans: Data link layer is responsible for carrying
packets from one hop (computer or router) to the next. The duties of data link layer include
packetizing, adderssing, error control, flow control, medium access control.
41.What are the types of errors? Ans: Errors can be categorized as a single-bit error or
burst error. A single bit error has one bit error per data unit. A burst error has two or more
bits errors per data unit.
42.What do you mean by redundancy? Ans: Redundancy is the concept of sending extra
bits for use in error detection. Three common redundancy methods are parity check, cyclic
redundancy check (CRC), and checksum.
51
COMPUTER NETWORKS LABORATORY 2023-24

43.Define parity check. Ans: In parity check, a parity bit is added to every data unit so that
the total number of 1s is even (or odd for odd parity).Simple parity check can detect all single
bit errors. It can detect burst errors only if the total number of errors in each data unit is
odd.In two dimensional parity checks, a block of bits is divided into rows and a redundant
row of bits is added to the whole block.
44. Define cyclic redundancy check (CRC). Ans: C RC appends a sequence of redundant
bits derived from binary division to the data unit. The divisor in the CRC generator is often
represented as an algebraic polynomial.
45. What is hamming code? Ans: The hamming code is an error correction method using
redundant bits. The number of bits is a function of the length of the data bits. In hamming
code for a data unit of m bits, we use the formula 2r >= m+r+1 to determine the number of
redundant bits needed. By rearranging the order of bit transmission of the data units, the
hamming code can correct burst errors.
46.What do you mean by flow control? Ans: It is the regulation of sender’s data rate so
that the receiver buffer doesn’t become overwhelmed.i.e. flow control refers to a set of
procedures used to restrict the amount of data that the sender can send before waiting for
acknowledgement.
47.What do you mean by error control? Ans: Error control refers primarily to methods of
error detection and retransmission. Anytime an error is detected in an exchange, specified
frames are retransmitted. This process is called automatic repeat request (ARQ).
48.Define stop and wait ARQ. Ans: In stop and wait ARQ, the sender sends a frame and
waits for an acknowledgement from the receiver before sending the next frame.
49.Define Go-Back-N ARQ? Ans: In Go-Back-N ARQ, multiple frames can be in transit at
the same time. If there is an error, retransmission begins with the last Unacknowledged frame
even if subsequent frames arrived correctly. Duplicate frames are discarded.
50.Define Selective Repeat ARQ? Ans: In Selective Repeat ARQ, multiple frames can be
in transit at the same time. If there is an error, only unacknowledged frame is retransmitted.
50.What do you mean by pipelining, is there any pipelining in error control? Ans: The
process in which a task is often begun before the previous task has ended is called pipelining.
There is no pipelining in stop and wait ARQ however it does apply in Go-Back-N ARQ and
Selective Repeat ARQ.
51.What is HDLC? Ans: It is a bit oriented data link protocol designed to support both half
duplex and full duplex communication over point to point and multi point links.HDLC is
characterized by their station type,configuration and their response modes.
52.What do you mean by point to point protocol? Ans: The point to point protocol was
designed to provide a dedicated line for users who need internet access via a telephone line or
a cable TV connection. Its connection goes through three phases: idle, establishing,
authenticating, networking and terminating. At data link layer it employs a version of HDLC.
53. What do you mean by point to point protocol stack? Ans: Point to point protocol uses
a stack of other protocol to use the link, to authenticate the parties involved, and to carry the
network layer data. Three sets of protocols are defined: link control protocol, Authentication
protocol, and network control protocol.
54.What do you mean by line control protocol? Ans: It is responsible for establishing,
maintaining, configuring, and terminating links.
55.What do you mean by Authentication protocol? Ans: Authentication means validating
the identity of a user who needs to access a set of resources. It is of two types i)Password
Authentication Protocol(PAP) ii)Challenge Handshake Authentication Protocol(CHAP) PAP
is a two step process. The user sends a authentication identification and a password. The
system determines the validity of the Information sent.CHAP is a three step process. The
52
COMPUTER NETWORKS LABORATORY 2023-24

system sends a value to the user. The user manipulates the value and sends the result. The
system Verifies the result.
56.What do you mean by network control protocol? Ans: Network control protocol is a
set of protocols to allow the encapsulation of data coming from network layer protocol that
requires the services of PPP.
57. What do you mean by CSMA? Ans: To reduce the possibility of collision CSMA
method was developed. In CSMA each station first listen to the medium (Or check the state
of the medium) before sending. It can’t eliminate collision.
58.What do you mean by Bluetooth? Ans: It is a wireless LAN technology designed to
connect devices of different functions such as telephones, notebooks, computers, cameras,
printers and so on. Bluetooth LAN Is an adhoc network that is the network is formed
spontaneously? It is the implementation of protocol defined by the IEEE 802.15 standard.
59.What is IP address? Ans: The internet address (IP address) is 32bits that uniquely and
universally defines a host or router on the internet. The portion of the IP address that
identifies the network is called netid. The portion of the IP address that identifies the host or
router on the network is called hostid.
60.What do you mean by subnetting? Ans: Subnetting divides one large network into
several smaller ones. It adds an intermediate level of hierarchy in IP addressing.
61.What are the advantages of fiber optics cable ? Ans: The advantages of fiber optics
cable over twisted pair cable are Noise resistance-As they use light so external noise is not a
factor. Less signal attenuation-fiber optics transmission distance is significantly greater than
that of other guided media.Higher bandwidth-It can support higher bandwidth.
62.What are the disadvantages of fiber optics cable? Ans: The disadvantages of fiber
optics cable over twisted pair cable are Cost-It is expensive Installation/maintenance-Any
roughness or cracking defuses light and alters the signal Fragility-It is more fragile.
63.What are the propagation type of radio wave ? Ans: Radio wave propagation is
dependent upon frequency.There are five propagation type. i)surface propagation
ii)Tropospheric propagation iii)Ionospheric propagation iv)Line of sight propagation v)space
propagation
64.What do you mean by Geosynchronous Satellites ? Ans: Satellite communication uses
a satellite in geosynchronous orbit to relay signals.The Satellite must move at the same speed
as the earth so that it seems to remain fixed above a certain spot..Only one orbit can be
geosynchronous.This orbit occurs at the equatorial plane and is approximately 22,000 miles
from the surface of earth.
65.What are the factors for evaluating the suitability of the media ? Ans: The factors are
cost,throughput,attenuation,Electromagneric interference(EMI),securtty.
66.What do you mean by medium access control(MAC) sublayer. Ans: The protocols
used to determine who goes next on a multi-access channel belong to a sublayer of the data
link layer is called the multi-access channel(MAC) sublayer.It is the buttom part of data link
layer.
67.What do you mean by ALOHA ? Ans: It is the method used to solve the channel
allocation problem .It is used for: i)ground based radio broadcasting ii)In a network in which
uncoordinated users are competing for the use of single channel. It is of two types: 1.Pure
aloha 2.Slotted aloha
68.What is pure ALOHA? Ans: It lets users transmit whenever they have data to
sent.Collision may occur but due to feedback property sender can know the status of
message.conflict occur when at one time more bits are transmitted.The assumptions are : i)all
frame size is same for all user. ii)collision occur when frames are transmitted simultaneously

53
COMPUTER NETWORKS LABORATORY 2023-24

iii)indefinite population of no of user. iv)N=number of frames/frame time iv)it obeys


poisson’s distribution if N>1 there will be collision 0<1
69.What is slotted ALOHA? Ans: In this method time is divided into discrete intervals,each
interval corresponding to one frame.It requires user to agree on slot boundaries.Here data is
not send at any time instead it wait for beginning of the next slot.Thus pure ALOHA is
tuened into discrete one.
70.What do you mean by persistent CSMA(carrier sense multiple access) ? Ans: When a
station has data to send,it first listens to the channel to see if anyone else is transmitting at
that moment.If channel is busy it waits until the station becomes idle. When collision occurs
it waits and then sends.It sends frame with probability 1 when channel is idle.
71.What do you mean by non persistent CSMA(carrier sense multiple access) ? Ans:
Here if no one else is sending the station begins doing so itself.However if the channel is
already in use,the station does’t continuously sense it rather it waits for a random period of
time and then repeats.It leads better channel utilization but longer delay.
72.What do you mean by p persistent CSMA(carrier sense multiple access) ? Ans: It
applies to slotted channels.when a station becomes ready to send,it senses the channel.If it is
idle it transmits with a probability P,with a probability Q=P-1 It defers until the next slot.If
that slot is also idle,it either transmits or defers again with probability P and Q.The process is
repeated until either the frame has been transmitted or another station begins transmitting.
73.What is FDDI? Ans: It is high performance fiber optic token ring LAN running at
100Mbps over distance up 1000 stations.FDDI access is limited by time.A FDDI cabling
consist of two fiber rings. i)one transmitting clockwise ii)one transmitting counterclockwise
74.What is Firewalls? Ans: It is an electronic downbridge which is used to enhance the
security of a network. It’s configuration has two components. i)Two routers ii)Application
gateway the packets traveling through the LAN are inspected here and packets meeting
certain criteria are forwarded and others are dropped.
75.What is Repeaters ? Ans: A receiver receives a signal before it becomes too weak or
corrupted,regenerates the original bit pattern,and puts the refreshed copy back onto the link.It
operates on phycal layer of OSI model.
76.What is Bridges? Ans: They divide large network into smaller components.They can
relay frames between two originally separated LANs.They provide security through
partitioning traffic.They operate on phycal and data link layer of OSI model.
77.What is Routers ? Ans: Router relay packets among multiple interconnected
networks.They receive packet from one connected network and pass it to another
network.They have access to network layer addresses and certain software that enables them
to determine which path is best for transmission among several paths.They operate on
phycal,data link and network layer of OSI model.
78.What is Gateway ? Ans: It is a protocol converter.A gateway can accept a packet
formatted for one protocol and convert it to a packet formatted for another protocol.It
operates on all the seven layers of OSI model.
79.What do you mean by Data Terminal Equipment(DTE) ? Ans: It is any device that is
source of or destination for binary digital data.At phycal layer it can be a terminal computer.
They generate or consume information.
80.What do you mean by Data Terminating Equipment (DCE) ? Ans: Data circuit
terminating equipment includes any functional unit that transmit or receives data in the form
of an analog or digital signal through a network.DTE generates digital data and passes them
to a DCE ,the DCE converts the data to a form acceptable to the transmission media and
sends the converted signal to another DCE on the network.

54
COMPUTER NETWORKS LABORATORY 2023-24

81.What do you mean by protocol stack ? Ans: The list of protocols used by certain
system ,one protocol per layer is called protocol stack.
82.What do you mean by peer ? Ans: Entities comprising the corresponding layers on
different machines are called peers.It may be • hardware device. • processes • human being
peers communicate by using protocol.
83.What do you mean by broadcasting ? Ans: Broadcast system allow addressing a packet
to all destination by using a special code in address field.when packet is transmitted it is
received and processed by every machine on the network.
84.What are the advantages of broadcast network. Ans: • a single communication
channel is shared by all computers. • packets are transmitted and received by all the
computer. • address field is attached to whom it is intended. • multicasting is used in network.
85.What do you mean by point to point network? Ans: Point to point network consist of
many connections between individual pair of machines.large networks are point to
point.Routing algorithm plays an important in point to point network.It uses stored ad
forword technique.It is a packet switching network.
86.What are the design issue of layers ? Ans: The design issue of layer are • Addressing
technique.ie source and destination address • Types of communication • Error control • Order
of message. • Speed matching • Multiplexing and demultiplexing.
87.What are the protocols in application layer ? Ans: The protocols defined in application
layer are • TELNET • FTP • SMTP • DNS
88.What are the protocols in transport layer ? Ans: The protocols defined in transport
layer are • TCP • UDP
89.Define TCP ? Ans: It is connection oriented protocol.It consist byte streams oeiginating
on one machine to be delivered without error on any other machine in the network.while
transmitting it fragments the stream to discrete messages and passes to interner layer.At the
destination it reassembles the messages into output stream.
90.Define UDP ? Ans: It is unreliable connectionless protocol.It is used for one-shot,client-
server type,requesr-reply queries and applications in which prompt delivery is required than
accuracy.
91.Define IP ? Ans: Internetwork protocol (IP) is the transmission mechanism used by
TCP/IP protocol.It is an unreliable and connectionless datagram protocol.It provides no error
checking and tracking.
92.What do you mean by client server model ? Ans: In client server model ,the client runs
a program to request a service and the server runs a program to provide the service.These two
programs communicate with each other. One server program can provide services to many
client programs.
93.What are the information that a computer attached to a TCP/IP internet must
possesses ? Ans: Each computer attached to TCP/IP must possesses the following
information • Its IP addesss • Its subnet mask • The IP addesss of the router. • The Ip address
of the name server.
94.What is domain name system(DNS)? Ans: Domain Name System (DNS )is a client
server application that identifies each host on the internet with a unique user friendly name.
95.What is TELNET ? Ans: TELNET is a client –server application that allows a user to
log on to a remote machine,giving the user access to the remote system. TELNET is an
abbreviation of terminal Network.
96.What do you mean by local login and remote login ? Ans: When a user logs into a
local time-sharing system ,it is called local login. When a user wants to access an application
program or utility located on a remote machine,he or she performs remote login.

55
COMPUTER NETWORKS LABORATORY 2023-24

97.What is Network Virtual Terminal ? Ans: A universal interface provided by TELNET


is called Network Virtual Terminal(NVT) character set.Via this interface TELNET translates
characters (data or command) that come from local terminal into NVT form and delivers
them to the network.
98.What do you mean by Simple Mail Transfer Protocol ? Ans: The TCP/IP protocol that
supports electronic mail on the internet is called Simple Mail Transfer Protocol.SMTP
provides for mail exchange between users on the same or different computer and supports
Sending a single message to one or more recipient Sending message that include text,
voice,video,or graphics.Sending message to users on network outside the internet.
99.What is Hypertext Transfer Protocol(HTTP) ? Ans: It is the main protocol used to
access data on the World Wide Web .the protocol transfers data in the form of plain
text,hypertext,audio,video,and so on. It is so called because its efficiency allows its use in a
hypertext environment where there are rapid jumps from one document to another.
100.What is URL ? Ans: It is a standard for specifying any kind of information on the
World Wide Web.
101. What is World Wide Web ? Ans: World Wide Web is a repository of information
spread all over the world and linked together.It is a unique combination of
flexibility,portability,and user-friendly features .The World Wide Web today is a distributed
client-server service,in which a client using a browser can access a service using a server.The
service provided is distributed over many locations called web sites.
102.What is HTML ? Ans: Hypertext Markup Language (HTML) is a language for creating
static web pages

56
COMPUTER NETWORKS LABORATORY 2023-24

57
COMPUTER NETWORKS LABORATORY 2023-24

58

You might also like