Академический Документы
Профессиональный Документы
Культура Документы
INDEX
EXPERIMENT NO. 1
A local area network (LAN) is a computer network that connects computers and devices in a
limited geographical area such as home, school, computer laboratory or office building. The
defining characteristics of LANs, in contrast to wide area networks (WANs), include their
usually higher data-transfer rates, smaller geographic area, and lack of a need for leased
telecommunication lines
Fig 1.1
ESTABLISHING LAN
Hardware Required
ii. Ethernet cards on a PCI or ISA port (with an RJ45 plug) or built into the motherboard.
When applicable, make sure the diodes
Fig 1.3
On the back of the network card light up when the computer is on and that a cable is plugged
in! There are also network adapters for USB ports, particularly in the case of wireless
network adapters;
iv. A hub, a device you can connect the RJ45 cables from the network's various computers to,
or a switch,
Fig 1.4
ARCHITECTURE TO AVOID:-
Incorrect RJ45 network
Fig 1.5
Configuration of LAN:-
1. Bandwidth:-
On LAN technologies, the usual bandwidth is 10Mbps, 100Mbps, 1000Mbps and
starting now in some cases, 10000Mbps.
Table 1.1
2. Amount of ports:-
References:-
.http://duxcw.com/digest/Howto/network/cable/cable5.htm
http://nullmodem.com/RJ-45.htm
http://en.wikipedia.org/wiki/Registered_jack -
EXPERIMENT No. 2
Cat-5:-
Category 5 cable is a twisted pair high signal integrity cable type often referred to
as Cat5 or Cat-5. Most Category-5 cables are unshielded, relying on the twisted pair design
for noise rejection. Category 5 has been superseded by the Category 5 specification. This type
of cable is used in structured cabling for computer networks such as Ethernet and ATM, and
is also used to carry many other signals such as telephony and video.
Fig 2.1
Cat-6:-
Fig 2.2
CRIMPING IN RJ45:-
1. RJ45:-
RJ45 connectors are commonly used with Cat5 cable to connect computers to
networks. The connection can be to an Ethernet network, or to an Internet connectivity
device such as a router, cable modem, or DSL modem.Cat5 cable contains a set of color-
coded cable wire pairs. When the cable is connected to an RJ45 connector, the color-
coded wires must be set in a particular order that varies with the intended usage. We use
a crimping tool to connect or crimp the RJ45 connector and the Cat5 cable.
2. Things Required:-
i. CAT5 cable
ii. RJ 45 connectors
3. Procedure:-
a) Cut the CAT5 cable to the desired length. Strip 2 inches of jacket off one
end of the cable, exposing the color-coded wire pairs within.
b) Reorganize the color-coded wires into the pattern required for your
particular use.
c) Flatten and align the color-coded wires, then cut them in a straight line at a
length of between a 1/2 inch and 3/4 inch.
d) Place an RJ 45 connector on the end of the cable with the prong on the
underside.
Fig 2.3
e) Push the connector onto the wires until the copper ends of the wires are visible
through the end of the connector.
References:-
http://duxcw.com/digest/Howto/network/cable/cable5.htm
http://nullmodem.com/RJ-45.htm
http://en.wikipedia.org/wiki/Registered_jack -
www.pjtool.com.
EXPERIMENT NO. 4
CASE STUDY OF STOP AND WAIT PROTOCOL
Design and Implementation
The sender in this protocol simply retrieves a packet from the network layer, copies it
into a frame, and then transmits it. After transmission, the sender busy waits until an
acknowledgement is received from the receiver, then the loop starts over again.
The receiver simply busy waits until a frame is received. Once a frame is received it
passes the data packet to the network layer and sends an acknowledgement for the frame it
just received. It then loops back to busy waiting and the process continues until the End of
File is reached.
In this protocol, there can only be one outstanding frame at a time so no sequence
numbers are required and the acknowledgement the receiver sends back to the sender is
nothing more than an empty frame, as there is no other possibility then acknowledging the
only frame sent. Another frame will not be sent until this acknowledgement is received.
Performance
The Stop and Wait protocol was very easy to implement and runs very quickly and
efficiently. It solves the problem of congestion, as only one frame is outstanding at any time,
frames cannot be lost due to congestion and the receiver will not be swamped by the sender.
Point of failure
The problem with it is that it assumes an error free communication channel and in the
real world, such a channel does not exist. It is easy to see that if a frame or an
acknowledgement gets lost or damaged, a deadlock situation will occur where neither the
sender or receiver can advance, and they will be thrown into infinite loops.
Fig 4.1
Fig 4.2
REFERENCES:
http://en.wikipedia.org/wiki/Stop-and-wait_ARQ
http://www.javiervalcarce.eu/wiki/The_Stop-And-Wait_ARQ_Protocol
EXPERIMENT NO.3
CASE STUDY OF WAN
WAN:
A wide area network (WAN) is a computer network that covers a broad area (i.e., any
network whose communications links cross metropolitan, regional, or national boundaries ).
This is in contrast with personal area networks (PANs), local area networks (LANs), campus
area networks(CANs), or metropolitan area networks (MANs) which are usually limited to a
room, building, campus or specific metropolitan area (e.g., a city) respectively.
Table 3.1
ADVANTAGES OF WAN:
1. Covers a large geographical area so long distance businesses can connect on the one
network.
2. Shares software and resources with connecting workstations.
3. Messages can be sent very quickly to anyone else on the network. These messages
can have pictures, sounds, or data included with them (called attachments).
4. Share information/files over a larger area.
Fig 3.1
References:
http://www.cisco.com/en/US/docs/internetworking/technology/handbook/Intro-to-WAN.html
http://www.compnetworking.about.com/cs/lanvlanwan/g/bldef_wan.htm
EXPERIMENT NO. 5
Sliding window is a flow control technique which belongs to the Data Link layer of the OSI
model. It solves the problem of missing frames during data transmission between two upper
layers, so that they can send and receive frames in order.
ACK scheme is used on a noisy link, in which receiver sends an ACK for every frame
received (note that when the receiver sends an acknowledge for frame s, this is understood to
mean that all frames up to and including s have been received).
NAK (negative acknowledgement) is used on a reliable link on which message loss is not
frequent. In this scheme receiver only sends an ACK for a lost frame.
Sliding Window
With a stop-and-wait protocol, the sender waits for an acknowledgment after transmitting
every frame. As a result, there is at most a single outstanding frame on the channel at any
given time, which may be far less than the channel's capacity. For maximum throughput, the
amount of data in transit at any given time should be (channel bandwidth) * (channel delay).
The key feature of the sliding-window protocol is that it permits pipelined communication to
better utilize the channel capacity. The sender can send a maximum N frames without
acknowledgement. N is called the window size of the sliding window. The sliding window
maps to the frames in sender’s buffer that are to be sent, or have been sent and now are just
waiting for acknowledgement.
The sender assigns a sequence number to each frame. At any time, the sender maintains the
list of sequence numbers corresponding to frames it is permitted to send. For example, TCP
connection establishment involves the sender and receiver exchanging their start squence
numbers in the SYN/ACK packets
Since frames currently within the sender's window may ultimately be lost or damaged in
transit, the sender must keep all these frames in its memory for possible retransmission. Thus,
the sender must have a buffer of at least the size of the sliding window.
The sender records the time at which each packet is sent. If the sender does not receive an
acknowledgment for a frame after timeout, it retransmits the this frame.
For a receiver using selective repeat, the sliding window is the group of frames that its
receiving buffer maps to. A receiver using Go-back-N does not have a buffer and thus does
not have a concept of window.
Sophisticated protocols can dynamically adapt the window size, trying to find a size suitable
for both sender and receiver. Receiver can indicate the new desired window size in the
acknowledgement.
When it first receives frame 0, it pass it on to higher protocol and returns ACK0 to sender.
Then it receives 1, 2, 3, 4 and does the same thing. After it receives 4, it receives 6, and it
knows that frame 5 is missing. So it will discard frame 6 and all later frames (7, 0, 1, ..), until
it receives frame 5.
In Selective Repeat, receiver has a buffer of the window size to cope with out-of-order
frames. It always tries to pass on as many frames as possible in the buffer to higher protocol
layer.
Suppose the receiver has just passed on frame 4, and the buffer is now empty. Now frame 5
arrives. It will pass it on straight-away and returns ACK5 to sender. Then comes frame 6, 7,
0, 1, 2, 3 and it does the same thing. The buffer is kept empty.
After frame 3 arrives, there comes frame 5, and the receiver knows that frame 4 is missing. It
will not directly pass frame 5 on, nor will it discard it. Instead it puts frame 5 in the second
place in the buffer, and returns ACK5. When later frames arrives, the receiver puts them
sequentially in the buffer and returns ACK for each of them, until the buffer is full. Then it
will discard all following frames and do not acknowledge them. All through this process it
will not pass on any frame until the first missing one arrives.
This way the sender needs to send only the missing frame, and the receiver can still pass on
frames in order.
Sender Logic
After sender sends out its full window, it waits for ACK. If it has received ACK for all
frames up to frame n, it will move its window to contain following frames, so that the first
frame in the window is frame (n + 1). Then it sends out all unsent frames in this window and
waits for new ACK.
Suppose sender has sent out its full window 0 ~ 7 and is now waiting for ACK, and frame 3
is lost. It will first receive ACK 0, 1, 2, and it moves its window to 3, 4, 5, 6, 7, 0, 1, 2 and
sends unsent frames 0, 1, 2, and continue to wait. Suppose 0, 1, 2 is received by the receiver.
If it is Go-back-N, it will not receive any more ACK after ACK 0, 1, 2. After time out, it
knows that frame 3 and all following frames are lost. So it will resend all frames in the
window: 3, 4, 5, 6, 7, 0, 1, 2.
Overview
Selective repeat ARQ is seldom used because of its requirement on receiver’s buffer.
Performance
The Go Back N protocol is fairly tricky to implement. If the window size matches the range
of sequence numbers the protocol can break and implementation is extremely difficult. By
using the range of sequence numbers greater than the window size, the receiver and the
sender can be kept in synchronization even when frames and acknowledgements are lost at
high rate. The Protocol easily handles congestion errors, bad frames and lost frames. Most
difficult part was trying to find the optimum timeout value that provided efficient
transmission for all error rates. Smaller timeout value seemed better on higher error rates but
to optimize at lower error rates a slightly higher value of timeout was selected.
The Selective Repeat protocol was difficult to implement. The sequence numbers need to be
greater than the window size so that no overlap can occur in the window. This allows receiver
and sender to be kept in synchronization even when frames and acknowledgements are lost at
a very high rate. The buffering and acknowledgements allow this protocol to easily handle
congestion, bad frames and lost frames. It was found that a much higher timeout value is
needed than in Go Back N in order to reduce the number of frames sent. A lower timeout
value results in too many frames timing out and being retransmitted unnecessarily, since the
receiver maintains a buffer of frames and can send a nak for exactly the frame sequence
number it needs. We have chosen 25 as a timeout value, and kept the from_physical_layer
parameter to 100,000 because these two values worked the best for a wide range of error
rates.
Fig 5.1
REFERENCES:
http://en.wikipedia.org/wiki/Selective_Repeat_ARQ
www.javvin.com/networkingterms/SelectiveRepeatARQ.htm
EXPERIMENT NO 10
WHAT IS LRC:
and columns).
Then calculate the parity bit for each column and create a new row of 8 bits, which
First parity bit in the fifth row is calculated based on all first bits,and so on.
Then attach the 8 parity bits to the original data and send them to the receiver.
Original data
1 1 1 0 0 1 1 1
1 1 0 1 1 1 0 1
0 0 1 1 1 0 0 1
1 0 1 0 1 0 0 1
-----------------
1 0 1 0 1 0 1 0 ßLRC
CODE:
#include<stdio.h>
#include<conio.h>
void main()
{
char a[12],b[4],c[4],d[4];
int LRC[4];
int i;
clrscr();
fflush(stdin);
scanf("%s",a);
for(i=0;i<4;i++)
b[i]=a[i];
c[i]=a[i+4];
d[i]=a[i+8];
for(i=0;i<4;i++)
printf("%c",b[i]);
printf("\n");
for(i=0;i<4;i++)
printf("%c",c[i])\\
printf("\n");
for(i=0;i<4;i++)
{
printf("%c",d[i]);
for(i=0;i<4;i++)
LRC[i]=(b[i]-48)^(c[i]-48)^(d[i]-48);
for(i=0;i<4;i++)
printf("%d",LRC[i]);
getch();
OUTPUT
101011001110
1010
1100
1110
1000
References:-
www.wikipedia.com
www.google.com
EXPERIMENT No.9
Parity check
Parity check (sometimes called VRC, for Vertical Redundancy Check or Vertical
Redundancy Checking) is one of the simplest checking mechanisms. It involves adding an
additional bit (called a parity bit) to a certain number of bits of data called a code word
(generally 7 bits, so as to form a byte when combined with the parity bit) whose value (0 or
1) is such that the total number of 1 bits are even. To be more straightforward, 1 if the
number of bits in the code word is odd, 0 otherwise.
Fig 11.1
CODE:
#include<stdio.h>
#include<conio.h>
void main()
{
char arr[8];
int i,count=0,vrc;
clrscr();
scanf("%s",arr);
for(i=0;i<8;i++)
{
if(arr[i]=='1')
count++;
}
if(count%2!=0)
vrc=1;
else
vrc=0;
for(i=0;i<5;i++)
printf("%c",arr[i]);
printf("%d",vrc);
getch();
}
OUTPUT
References:-
www.wikipedia.com
www.google.com
EXPERIMENT NO. 11
Typically, an n-bit CRC, applied to a data block of arbitrary length, will detect any single
error burst not longer than n bits (in other words, any single alteration that spans no more
than n bits of the data), and will detect a fraction 1−2 −n of all longer error bursts. Errors in
both data transmission channels and magnetic storage media tend to be distributed non-
randomly making CRCs' properties more useful than alternative schemes such as multiple
parity checks.
The simplest error-detection system, the parity bit, is in fact a trivial 1-bit CRC: it uses the
generator polynomial x+1.
CODE:
#include<stdio.h>
#include<math.h>
#include<conio.h>
int decm1(int,int *);
int decm(int,int *);
int rx[20];
void main()
{
int n,num,gx[20],dx[30],fx[20],i;
int app,k,m,no,val,j;
clrscr();
printf("Enter length of dx: ");
scanf("%d",&m);
printf("Enter the value of dx: ");
for(i=0;i<m;i++)
{
scanf("%d",&dx[i]);
}
printf("\nEnter length of gx: ");
scanf("%d",&n);
printf("\nEnter the value of gx: ");
for(i=0;i<n;i++)
{
scanf("%d",&gx[i]);
}
app=n-1;
k=m+app;
for(i=m;i<k;i++)
dx[i]=0;
printf("\nMODIFIED VALUE OF BITS TO BE TRANSMITTED: ");
for(i=0;i<k;i++)
printf("%d",dx[i]);
no=k-n;
for(i=0;i<n;i++) {
if (gx[i]==dx[i])
rx[i]=0;
else
rx[i]=1;
}
while(no!=0)
{
rx[n]=dx[i];
if(rx[1]==0)
{
for(j=0;j<n;j++)
fx[j]=0;
for(j=0;j<n;j++)
{
if (fx[j]==rx[j+1])
rx[j]=0;
else
rx[j]=1;
}
printf("\n");
for(j=0;j<n;j++)
printf("%d",rx[j]);
}
else
{
for(j=0;j<n;j++)
{
if (gx[j]==rx[j+1])
rx[j]=0;
else
rx[j]=1;
}
printf("\n");
for(j=0;j<n;j++)
printf("%d",rx[j]);
}
no--;
i++;
}
printf("CRC BITS");
num=n;
for(i=k-1;i>0;i--)
{
num--;
if(num>0)
{
if(dx[i]==rx[num])
dx[i]=0;
else
dx[i]=1;
}
}
printf("\nTranssmitted bits: ");
for(i=0;i<k;i++)
printf("%d",dx[i]);
for(i=0;i<n; i++)
{
if (gx[i]==dx[i])
rx[i]=0;
else
rx[i]=1;
}
for(i=0;i<n;i++)
printf("%d",rx[i]);
no=k-n;
while(no!=0)
{
rx[n]=dx[i];
if(rx[1]==0)
{
for(j=0;j<n;j++)
fx[j]=0;
for(j=0;j<n;j++)
{
if (fx[j]==rx[j+1])
rx[j]=0;
else
rx[j]=1;
}
printf("\n");
for(j=0;j<n;j++)
printf("%d",rx[j]);
}
else
{
for(j=0;j<n;j++)
{
if (gx[j]==rx[j+1])
rx[j]=0;
else
rx[j]=1;
}
printf("\n");
for(j=0;j<n;j++)
printf("%d",rx[j]);
}
no--;
i++;
}
printf("\nremainder bits:");
for(i=0;i<n;i++)
printf("%d",rx[i]);
for(i=0;i<n;i++)
{
if (rx[i]==0)
val=0;
else
val=1;
}
if(val==0)
printf("\n NO ERROR IN TRANSMISSION:");
else
printf("\n ERROR IN TRANSMISSION: ");
getch();
}
OUTPUT:
1111
1010
11
10
remainder bits:10
NO ERROR IN TRANSMISSION
References:-
www.wikipedia.com
www.google.com
EXPERIMENT NO. 12
In mathematical terms, Hamming codes are a class of binary linear codes. For each integer
m>=2 there is a code with m parity bits and 2m − m − 1 data bits. The parity-check matrix of
a Hamming code is constructed by listing all columns of length m that are pairwise
independent. Hamming codes are an example of perfect codes, codes that exactly match the
theoretical upper bound on the number of distinct code words for a given number of bits and
ability to correct errors.
Because of the simplicity of Hamming codes, they are widely used in computer memory
(RAM). In particular, a single-error-correcting and double-error-detecting variant commonly
referred to as SECDED.
CODE:
#include<iostream.h>
#include<conio.h>
#include<math.h>
void main()
{
clrscr();
int a[30];
int n,t,r,b,c,j,i;
cin>>b;
for(r=1;;r++)
if((int)pow(2,r)>=(b+r+1))
break;
n=r-1;
for(t=(b+r);t>0;t--)
if((int)pow(2,n)!=t)
cin>>a[t];
else
a[t]=9;
n--;
for(t=(b+r);t>0;t--)
if(a[t]!=9)
cout<<a[t];
cout<<"\n";
t=b+r;
while(r>0)
r--;
n=(int)pow(2,r);
j=n;
c=0;
while(j<=t)
for(i=1;i<=n&&j<=t;i++)
if(a[j++]==1)
c++;
for(i=1;i<=n&&j<=t;i++)
j++;
a[n]=(((c%2)==0)?0:1);
for(i=t;i>0;i--)
cout<<a[i];
getch();
OUTPUT:
11010
11110
10101
11001
10110
1101011110101011100110110
11010011110101011100101011000
References:-
www.wikipedia.com
www.google.com