Com Lab-2 Jvit JBK Manual
Com Lab-2 Jvit JBK Manual
V Semester
Communication Lab II
Course Code 21ECL55 CIE Marks 50
Course objectives:
This laboratory course enables students to
⚫ Design and demonstrate communication circuits for different digital modulation
techniques.
⚫ To simulate Source coding Algorithms using C/C++/ MATLAB code.
⚫ To simulate Error correcting and detecting codes using C/C++/ MATLAB code.
⚫ Simulate the networking concepts and protocols using C/C++/ Network simulation tool.
⚫ Understand entropies and mutual information of different communication channels.
Sl.No. Experiments
6 Write a program to encode binary data using a (7,4) Hamming code and decode it.
7 Write a program to encode binary data using a ((3,1,2)/suitably designed)
Convolution code and
decode it.
8 For a given data, use CRC-CCITT polynomial to obtain the CRC code. Verify the
program for the
cases a) Without error b) With error
10 Write a program for distance vector algorithm to find suitable path for transmission.
11 Write a program for flow control using sliding window protocols.
8
COMMUNICATION LABORATORY-II 2023-24
14 Simulate the BER performance of (2, 1, 3) binary convolutional code with generator
sequences
g(1) =(1 0 1 1) and g(2) =(1 1 1 1) on AWGN channel. Use QPSK modulation
scheme. Channel
decoding is to be performed through Viterbi decoding. Plot the bit error rate versus
SNR (dB), i.e.
Pe,b versus Eb/N0. Consider binary input vector of size 3 lakh bits. Also find the
coding gain.
15 Simulate the BER performance of (7, 4) Hamming code on AWGN channel. Use
QPSK modulation scheme. Channel decoding is to be performed through
maximum-likelihood decoding. Plot the bit error rate versus SNR (dB), i.e. Pe,b
versus Eb/N0. Consider binary input vector of size 5 lakh bits. Use the following
parity check matrix for the (7, 4) Hamming code. Also find the coding gain.
1001110
H= [0 1 0 0 1 1 1]
0011101
16 Simulate the BER performance of rate 1/3 Turbo code. Turbo encoder uses
two recursive systematic encoders with
1+𝐷 4
G(D) = [1, 1+𝐷+𝐷2+𝐷3+𝐷4 ]
9
COMMUNICATION LABORATORY-II 2023-24
credits allotted to each course. The student has to secure not less than 35% (18 Marks out of
50) in the semester-end examination (SEE).
Continuous Internal Evaluation (CIE):
CIE marks for the practical course is 50 Marks.
The split-up of CIE marks for record/ journal and test are in the ratio 60:40.
⚫ Each experiment to be evaluated for conduction with observation sheet and record write-
up. Rubrics for the evaluation of the journal/write-up for hardware/software experiments
designed by the faculty who is handling the laboratory session and is made known to
students at the beginning of the practical session.
⚫ Record should contain all the specified experiments in the syllabus and each experiment
write-up will be evaluated for 10 marks.
⚫ Total marks scored by the students are scaled downed to 30 marks (60% of maximum
marks).
⚫ Weightage to be given for neatness and submission of record/write-up on time.
⚫ Department shall conduct 02 tests for 100 marks, the first test shall be conducted after
the 8th week of the semester and the second test shall be conducted after the 14th week
of the semester.
⚫ In each test, test write-up, conduction of experiment, acceptable result, and procedural
knowledge will carry a weightage of 60% and the rest 40% for viva-voce.
⚫ The suitable rubrics can be designed to evaluate each student’s performance and learning
ability. Rubrics suggested in Annexure-II of Regulation book
⚫ The average of 02 tests is scaled down to 20 marks (40% of the maximum marks).
The Sum of scaled-down marks scored in the report write-up/journal and average marks of
two tests is the total CIE marks scored by the student.
Semester End Evaluation (SEE):
SEE marks for the practical course is 50 Marks.
SEE shall be conducted jointly by the two examiners of the same institute, examiners are
appointed by the University
All laboratory experiments are to be included for practical examination. (Rubrics) Breakup of
marks and the instructions printed on the cover page of the answer script to be strictly
adhered to by the examiners. OR based on the course requirement evaluation rubrics shall be
decided jointly by examiners.
Students can pick one question (experiment) from the questions lot prepared by the internal
/external examiners jointly.
Evaluation of test write-up/ conduction procedure and result/viva will be conducted jointly
by examiners.
General rubrics suggested for SEE are mentioned here, writeup-20%, Conduction procedure
and result in -60%, Viva-voce 20% of maximum marks. SEE for practical shall be evaluated
for 100 marks and scored marks shall be scaled down to 50 marks (however, based on course
type, rubrics shall be decided by the examiners).
Change of experiment is allowed only once and 15% Marks allotted to the procedure part to
be made zero.
The duration of SEE is 03 hours.
10
COMMUNICATION LABORATORY-II 2023-24
INTRODUCTION
11
COMMUNICATION LABORATORY-II 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.
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.
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.
Key Features
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.
14
COMMUNICATION LABORATORY-II 2023-24
EXPERIMENT NO – 1
FSK MODULATOR:
15
COMMUNICATION LABORATORY-II 2023-24
DESIGN:
Ic = 2.5mA
VRE = 2.5V
RE = VRE / IE = 2.5 / 2.5mA = RE = 1KΩ
VRB = Vm(t)p-p / 2 –VBE(sat) – VRE(sat)
= 3.5 – 0.7 – 2.5
VRB = 0.3V
Ib = Ic / hfe = 2.5 / 100 = 2.5µA
Ib(sat) = 1.2Ib
Ibsat = 30µA
RB = Vrb / Ibsat = 0.3 / 30 = Rb = 10KΩ
FSK DEMODULATOR:
16
COMMUNICATION LABORATORY-II 2023-24
2. The modulating signal m(t) is chosen to be low freq (50 Hz to 300Hz) square wave.
3. The 10K pot is varied so as to get proper FSK output.
4. Record the wave and calculate the 2 frequencies of operation of 555 Astable
multivibrator. Compare these two frequencies calculate theoretically.
MODULATION WAVEFORMS:
DEMODULATION WAVEFORM:
17
COMMUNICATION LABORATORY-II 2023-24
EXPERIMENT NO. 2
PHASE SHIFT KEYING GENERATION AND DETECTION
PROCEDURE:
PSK DEMODULATOR:
WAVEFORMS:
19
COMMUNICATION LABORATORY-II 2023-24
EXPERIMENT NO. 3
DIFFERENTIAL PHASE SHIFT KEYING (DPSK) GENERATION AND
DERECTION
PROCEDURE:
1. The experiment makes use of two trainers namely, ST2106 & ST2107. ST2111 serves
as a 8-bit data source. ST2106 serves as data formatting (conditioning) device while
ST2107 reformats (recondition) the data.
2. ST2111 & ST2106 Trainers serves as transmitter for our system & ST2107 trainer
serves as receiver.
3. Ensure that all trainers are switched OFF, until the complete connections are made.
4. Make the following connections between ST2111 and ST2106 trainers as shown in
figure 1.
a. Carrier input of modulator 1 (tp26) to 960 KHz (1) carrier (tp17)
20
COMMUNICATION LABORATORY-II 2023-24
Figure: 2
9. To see the PSK demodulation process, examine the input of PSK demodulator (tp10)
on ST2107 trainer with the demodulator's output (tp15). Adjust the phase adjust control
& see its effect on the demodulator's output. Check the various test points provided at
21
COMMUNICATION LABORATORY-II 2023-24
the output of the functional blocks of the PSK demodulator. This will help you fully
grasp the PSK demodulation technique.
10. The output of the demodulator goes to the low pass filter 1's input. Monitor the filter's
output (tp24) with reference to its input (tp28) Notice that the filter has extracted the
average information from the demodulator output. Adjust the PSK demodulator's phase
adjust control until the amplitude of filter's output is maximum.
11. The low pass filter's output rounded & cannot be used for digital processing. In order
to 'square up' the waveform comparator's are used (data squaring circuit). The bias
control is adjusted so that the comparator's output pulse width at tp 47 is same as the
NRZ (M) pulse width which is observed in CRO
WAVEFORMS:
22
COMMUNICATION LABORATORY-II 2023-24
EXPERIMENT NO. 4
QUADRATURE PHASE SHIFT KEYING (QPSK) GENERATION AND
DETECTION
AIM: To study Quadrature phase shift keying (QPSK) Encoder & Decoder.
23
COMMUNICATION LABORATORY-II 2023-24
Phasor Diagram
It can be appreciated from the above phasor diagram that each phasor switches its phase
depending on the data level exactly in the same way as the same way as the PSK modulator
does. The only difference is that QPSK is sum of two such PSK modulators.
BLOCK DIAGRAM:
QPSK TRANSMITTER:
Figure: 1
24
COMMUNICATION LABORATORY-II 2023-24
QPSK RECEIVER:
Figure: 2
PROCEDURE:
1. The experiment makes use of two trainers namely, ST2106 & ST2107. ST2111 serves
as a 8-bit data source. ST2106 serves as data formatting (conditioning) device while
ST2107 reformats (recondition) the data.
2. ST2111 & ST2106 Trainers serves as transmitter for our system & ST2107 trainer
serves as receiver.
3. Ensure that all trainers are switched OFF, until the complete connections are made.
4. Make the additional connections as shown in figure 1 as shown in following steps.
On ST2106 trainer:
a. Differentially encoded dibit MSB (tp10) to unipolar bipolar converter 1 input
(tp20)
b. Unipolar-Bipolar converter 1 output (tp21) to modulator 1 input (tp27).
25
COMMUNICATION LABORATORY-II 2023-24
26
COMMUNICATION LABORATORY-II 2023-24
7. Monitor the output of the summing amplifier (tp36). The output is a QPSK Signal with
0, 90, 180 & 270 phase shifts clearly visible.
8. To observe the QPSK demodulation process, monitor each output (tp8 & 9) of the
QPSK demodulator with reference to input signal (tp1) on ST2107. Also monitor the
test points provided at various block outputs, to understand the process of demodulation
clearly.
9. Observe the two low pass filter's outputs (tp24 & 28). Adjust the phase adjust control
provided on QPSK demodulator block until you obtain two levels only at low pass
filter's outputs. The incorrect placement of phase adjust control produces multilevel
output at filter output.
10. Monitor both the comparator's output (tp47 & 50). Adjust the bias level control of both
comparators till their output doesn’t have the correct pulse width. Now that the filter's
output is balanced around 0 Volts. Adjustment of bias level to produce 0 V terminal of
the comparator help achieving 'Squared up' version of the filter's output signal. This
can be compared by simultaneously displaying the filter's output & the comparator's
output on the oscilloscope.
11. Temporarily disconnect & then reconnect the QPSK input to the QPSK demodulator.
Observe that after some trial you will obtain four different combinations at
comparator's outputs (tp47 & 50). This explains the phase ambiguity in QPSK system.
27
COMMUNICATION LABORATORY-II 2023-24
Experiment -5
Huffmann Coding and Decoding
Program:
x= input('Enter the number of symbols:');
N=1:x;
disp('The number of symbols are N:');
disp(N);
P=input('Enter the probabilities:');
disp('The probabilities are P:');
disp (P);
S=sort (P, 'descend');
disp('The sorted probabilities are:');
disp (S);
[dict, avglen]=huffmandict(N,S);
disp('The average length of the code is:');
disp (avglen);
H=0;
for i=1:x
H=H+ (P(i) *log2 (1/P (i)));
end
disp('Entropy is:');
disp (H);
disp('bits/msg');
28
COMMUNICATION LABORATORY-II 2023-24
E=(H/avglen) *100;
disp('Efficiency is:')
disp(E);
codeword=huffmanenco(N,dict);
disp('The codewords are:');
disp(codeword);
decode=huffmandeco(codeword,dict);
disp('The decoded output:');
disp(decode);
Expected Output
Entropy is:
2.1219
bits/msg
Efficiency is:
96.4513
1 0 0 0 0 1 0 0 1 1 0 0 1
Column 14
29
COMMUNICATION LABORATORY-II 2023-24
Experiment -6
Hamming Coding and Decoding
Aim: To encode binary data using a (7,4) Hamming code and decode it
Software: MATLAB
Theory: The Hamming Code method is a network technique designed by R.W.Hamming, for
damage and error detection during data transmission between multiple network channels.
The Hamming Code method is one of the most effective ways to detect single-data bit errors
in the original data at the receiver end. It is not only used for error detection but is also for
correcting errors in the data bit.
Here are some of the features of Hamming code:
Error Detection and Correction: Hamming code is designed to detect and correct single-bit
errors that may occur during the transmission of data. This ensures that the recipient receives
the same data that was transmitted by the sender.
Redundancy: Hamming code uses redundant bits to add additional information to the data
being transmitted. This redundancy allows the recipient to detect and correct errors that may
have occurred during transmission.
Efficiency: Hamming code is a relatively simple and efficient error-correction technique that
does not require a lot of computational resources. This makes it ideal for use in low-power
and low-bandwidth communication networks.
Single Error Correction: Hamming code is capable of correcting a single-bit error, which
makes it ideal for use in applications where errors are likely to occur due to external factors
such as electromagnetic interference.
Program:
clear
n = 7%# of codeword bits per block
k = 4%# of message bits per block
A = [ 1 1 1;1 1 0;1 0 1;0 1 1 ];%Parity submatrix-Need binary(decimal combination of
7,6,5,3)
G = [ eye(k) A ]%Generator matrix
H = [ A' eye(n-k) ]%Parity-check matrix
% ENCODER%
msg = [ 1 1 1 1 ] %Message block vector-change to any 4 bit sequence
code = mod(msg*G,2)%Encode message
% CHANNEL ERROR(add one error to code)%
%code(1)= ~code(1);
code(2)= ~code(2);
%code(3)= ~code(3);
%code(4)= ~code(4);%Pick one,comment out others
%code(5)= ~code(5);
%code(6)= ~code(6);
%code(7)= ~code(7);
recd = code %Received codeword with error
% DECODER%
syndrome = mod(recd * H',2)
%Find position of the error in codeword (index)
find = 0;
for ii = 1:n
30
COMMUNICATION LABORATORY-II 2023-24
if ~find
errvect = zeros(1,n);
errvect(ii) = 1;
search = mod(errvect * H',2);
if search == syndrome
find = 1;
index = ii;
end
end
end
disp(['Position of error in codeword=',num2str(index)]);
correctedcode = recd;
correctedcode(index) = mod(recd(index)+1,2)%Corrected codeword
%Strip off parity bits
msg_decoded=correctedcode;
msg_decoded=msg_decoded(1:4)
Expected output:
n=
k=
G=
1 0 0 0 1 1 1
0 1 0 0 1 1 0
0 0 1 0 1 0 1
0 0 0 1 0 1 1
H=
1 1 1 0 1 0 0
1 1 0 1 0 1 0
1 0 1 1 0 0 1
msg =
1 1 1 1
31
COMMUNICATION LABORATORY-II 2023-24
code =
1 1 1 1 1 1 1
recd =
1 0 1 1 1 1 1
syndrome =
1 1 0
correctedcode =
1 1 1 1 1 1 1
msg_decoded =
1 1 1 1
32
COMMUNICATION LABORATORY-II 2023-24
EXPERIMENT NO-08
Cyclic Redundancy Check
AIM: For a given data, use CRC-CCITT polynomial to obtain the CRC code.
Verify the program for the cases a) Without error b) With error
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;
while(pos<len-degree)
{
for(i= pos;i<pos+degree+1;++i)
33
COMMUNICATION LABORATORY-II 2023-24
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:
(Without error)
Enter data stream 10011
Transmitted frame is 10011100
34
COMMUNICATION LABORATORY-II 2023-24
35
COMMUNICATION LABORATORY-II 2023-24
EXPERIMENT NO – 9
9. Write a program for Congestion control using the 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.
36
COMMUNICATION LABORATORY-II 2023-24
PROGRAM :
#include<stdio.h>
#include<iostream.h>
#include<stdlib.h>
#include<conio.h>
#include<dos.h>
#define bucketsize 300
void bktinput(int a, int b)
{
if (a>bucketsize)
cout<<"\n\t bucket overflow";
else
{
delay(1000);
while(a>b)
{
cout<<"\n\t\t"<<b<<"bytes outputed";
a-=b;
delay(1000);
}
if (a>0)
cout<<"\n\t\t last"<<a<<"butes sent \t";
cout<<"\n\t bucket output sucessful";
}
}
void main()
{
int op,pktsize;
randomize();
cout<<"enter the outputrate:";
cin>>op;
for(int i=1;i<=3;i++)
{
delay (random(500));
pktsize=random(500);
37
COMMUNICATION LABORATORY-II 2023-24
OUTPUT 1 :
OUTPUT 2 :
38
COMMUNICATION LABORATORY-II 2023-24
EXPERIMENT NO-10
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:
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];
int cost[10][10],n;
void distvector()
39
COMMUNICATION LABORATORY-II 2023-24
{
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++)
{
if(table[i].dist[j]==99)
40
COMMUNICATION LABORATORY-II 2023-24
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 :
Example 1
0 2 99 4 3
2 0 5 99 99
99 5 0 99 7
4 99 99 0 8
3 99 7 8 0
41
COMMUNICATION LABORATORY-II 2023-24
42
COMMUNICATION LABORATORY-II 2023-24
EXPERIMENT NO – 11
AIM: Implementation of Stop and Wait Protocol and Sliding Window Protocol
THEORY:
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.
• 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.
43
COMMUNICATION LABORATORY-II 2023-24
#include<stdio.h>
#include<conio.h>
#include<stdlib.h>
#include<dos.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)
{
printf(“\n Sending frames %d”,i);
srand(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);
srand(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
45
COMMUNICATION LABORATORY-II 2023-24
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 may accept these frames or buffer them until the appropriate
frame is received and then pass the frames to the network layer in sequence.
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.
#include<stdio.h>
#include<conio.h>
#include<stdlib.h>
void main()
{
int w,i,f,frames[50];
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");
getch();
}
47
COMMUNICATION LABORATORY-II 2023-24
Output
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
46
Acknowledgement of above frames sent is received by sender
48
COMMUNICATION LABORATORY-II 2023-24
EXPERIMENT - 12
(BUS/STAR) TOPOLOGY USING SIMULATION SOFTWARE OR
CONFIGURE A SIMPLE NETWORK (RING/MESH) TOPOLOGY
Procedure:
49
COMMUNICATION LABORATORY-II 2023-24
50
COMMUNICATION LABORATORY-II 2023-24
51
COMMUNICATION LABORATORY-II 2023-24
EXPERIMENT - 13
Procedure:
52
COMMUNICATION LABORATORY-II 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.
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.
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.
53
COMMUNICATION LABORATORY-II 2023-24
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.
17.What is switching?
Ans: Switching in data communication is of three types Circuit switching Packet switching
Message switching
54
COMMUNICATION LABORATORY-II 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.
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.
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
56
COMMUNICATION LABORATORY-II 2023-24
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 system sends
a value to the user. The user manipulates the value and sends the result. The system Verifies
the result.
57
COMMUNICATION LABORATORY-II 2023-24
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
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
58
COMMUNICATION LABORATORY-II 2023-24
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.
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.
59
COMMUNICATION LABORATORY-II 2023-24
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.
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
60
COMMUNICATION LABORATORY-II 2023-24
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
61
COMMUNICATION LABORATORY-II 2023-24
62
COMMUNICATION LABORATORY-II 2023-24
63