0% found this document useful (0 votes)
70 views12 pages

Unit 3 Networking 1 (GZRSC)

Uploaded by

24w0591
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
70 views12 pages

Unit 3 Networking 1 (GZRSC)

Uploaded by

24w0591
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 12

Networking 1 GZRSC 2021

What is an Error?
The data can be corrupted during transmission (from source to receiver). A condition when
the receiver’s information does not match with the sender’s information It may be affected by
external noise or some other physical imperfections. In this case, the input data is not same as the
received output data. That means a 0 bit may change to 1 or a 1 bit may change to 0. This mismatched
data is called “Error”.
Types of Errors
Errors can be of three types, namely single
bit errors, multiple bit errors, and burst
errors.
 Single bit error − In the received
frame, only one bit has been
corrupted, i.e. either changed from 0
to 1 or from 1 to 0.

 Multiple bits error − In the received


frame, more than one bits are
corrupted.

 Burst error − In the received frame,


more than one consecutive bits are
corrupted.

Error detection and correction


Error detection and correction are implemented at the data link layer or the transport layer of the open
system interconnection model (OSI)
Flow Control:
In computer networks, flow control is defined as A set of procedures which are used for
restricting the amount of data that a sender can send to the receiver.
Error detection is a technique that is used to check if any error occurred in the data during
the transmission.
Error detection techniques
1.Single Parity Check
2.Cyclic Redundancy Check (CRC)

BCA Page 1
Networking 1 GZRSC 2021
3.Hamming Code
1.Single Parity Check
A parity bit is a check bit, which is added to a block of data for error detection purposes.
Before adding the parity bit, number of 1’s or zeros is calculated in the data. Based on this calculation
of data an extra bit is added to the actual information / data. The addition of parity bit to the data will
result in the change of data string size. Parity is count the number of 1’s.
There is two types of parity bits in error detection.
1.Even Parity − Here the total number of bits in the message is made even. If number of 1s is
even, parity bit value is 0. If number of 1s is odd, parity bit value is 1.
2. Odd Parity − Here the total number of bits in the message is made odd. If number of 1s is
odd, parity bit value is 0. If number of 1s is even, parity bit value is 1.
Drawbacks Of Single Parity Checking
1. It can only detect single-bit errors which are very rare.
2. If two bits are interchanged, then it cannot detect the errors

Example:
For Even Parity Checking
In even parity checking, our target is to make even number of 1’s in code word generate.
Data 1’s in Data P Total 1’s Code word
1010110 4 0 4 10101100
0101111 5 1 6 01011111
0000000 0 0 0 00000000
1001100 3 1 4 10011001
1111111 7 1 8 11111111
For Odd Parity Checking
Our target is to make odd number of 1’s in code word generated in odd parity checking.
Data 1’s in Data P Total 1’s Code word
0110101 4 1 5 01101011
0101111 5 0 5 01011110
0000000 0 1 1 00000001
1011000 3 0 3 10110000
1111111 7 0 7 11111110

BCA Page 2
Networking 1 GZRSC 2021
2. Cyclic Redundancy Check (CRC)
Cyclic Redundancy Check (CRC) is an error detection method. It is based on binary division.
Cyclic Redundancy Check (CRC) is a block code invented by W. Wesley Peterson in 1961. It is
commonly used to detect accidental changes to data transmitted via telecommunications networks
and storage devices.
CRC involves
lves binary division of the data bits being sent by a predetermined divisor agreed
upon by the communicating system. The divisor is generated using polynomials. So, CRC is also
called polynomial code checksum.

Sender Receiver
Data : Data + CRC
Division : XOR CRC Generator
CRC Generator : n bits
CRC bits : (n-1) er is all zero, the data is
If remainder iscorrect
CRC bits=Data + (n-1)0s
CRC Generator.

Remainder is CRC
Data + CRC send to receiver

Example :
Sender : Receiver :
Data = 101101 Data=10110010
CRC Generator:=1101 (n) 4 bits Data crc
CRC bits =3 (n-1) 4
1) 4-1=3 CRC Generator=1101
Division = XOR

1101 101101000 1101 101101010


1101 1101
01100 01100
Omit zero 1101 1101
On left side 0001100 0001101
1101 1101
00010 CRC 00000
The sender send data + CRC bit =101101010 Remainder is zero, no error

CRC generator is an algebraic polynomial


polynomia represented as a bit pattern.
Bit pattern is obtained from the CRC generator using the following rule-
rule
The power of each term gives the position of the bit and the coefficient gives the value of the bit.

Consider the CRC generator is x7 + x6 + x4 + x3 + x + 1


as
The corresponding binary pattern is obtained as-

Thus, for the given CRC generator, the corresponding binary pattern is 11011011.

BCA Page 3
Networking 1 GZRSC 2021
3. Hamming Code
Hamming code is used to detect and correct the error in the transmitted data. So, it is an
error detection and correction code. It was originally invented by Richard W. Hamming in the year
1950. Hamming codes detect 1-bit and 2-bit errors.
While transmitting the message, it is encoded with the redundant bits. The redundant bits are the
extra bits that are placed at certain locations of the data bits to detect the error. At the receiver end,
the code is decoded to detect errors and the original message is received.
So before transmitting, the sender has to encode the message with the redundant bits. It involves
three steps.
Encoding the message with hamming code
1.Selecting the number of redundant bits
The hamming code uses the number of redundant bits depending on the number of
information bits in the message.
Let n be the number of information or data bits, then the number of redundant bits P is
determined from the following formula.
2r ≥ m+r+1
For example, if 4-bit information is to be transmitted, then n=4. The number of redundant bits
is determined by the trial and error method.

2r ≥ m+r+1
Let r=1, we get, Let r=2, we get, Let r=3, we get,
21 ≥ 4 + 1 + 1 22 ≥ 4 + 2 + 1 23 ≥ 4 + 3 + 1
2=6 x 4=7 x 8=8 

In this way, the number of redundant bits is selected for the number of
information bits to be transmitted
2. Choosing the location of redundant bits
For the above example, the number of data bits n=4, and the number of redundant bits P=3. So
the message consists of 7 bits in total that are to be coded. Let the rightmost bit be designated as bit
1, the next successive bit as bit 2 and so on.
The seven bits are bit 7654321
3. Assigning the values to redundant bits
Now it is time to assign bit value to the redundant bits in the formed hamming code group.
The assigned bits are called a parity bit.

BCA Page 4
Networking 1 GZRSC 2021

Example
Data (m)= 1001 4bit
(r )= 3 [ p4 p2 p1 ] position
Length of data= 7  7 6 5 4 3 2 1
1 0 0 p4 1 p2 p1

( p4 p2 p1)
1 0 0 1 p1= 1,3,5,7= Where the first (p1) position having one(1)
2 0 1 0 p2=2,3,6,7= Where the Second (p2) position having one (1)
3 0 1 1 P3=4,5,6,7= Where the third (p3) position having one (1)
4 1 0 0 Then,
5 1 0 1 p1=1,3,5,7= p1101
6 1 1 0 p2=2,3,6,7= p2 101
7 1 1 1 P3=4,5,6,7= p4 001
Let us consider even parity bit
Two one=even=0
p1=1,3,5,7= p1101 =0  0101 p1=0
p2=2,3,6,7= p2 101 =0  0101 p2=0
P3=4,5,6,7= p4 001 =1 1001 p4=1
Single one=odd=1
Replace the value of data 7 6 5 4 3 2 1
1 0 0 p4 1 p2 p1
The data is send to receiver 1 0 0 1 1 0 0

How to detect and correct the error in the hamming code?


After receiving the encoded message, each parity bit along with its corresponding group of
bits are checked for proper parity. While checking, the correct result of individual parity is marked as
0 and the wrong result is marked as 1.

Length of data= 7  7 6 5 4 3 2 1
1 0 0 1 1 0 0 (receive data from sender)
p1=1,3,5,7  0101 p1=0 if we get, the parity bit is all zero, the data is correct
p2=2,3,6,7  0101 p2=0
P3=4,5,6,7  1001 p4=0

If the formed binary word has 0 bits, then there is no error in the message.

Length of data= 7  7 6 5 4 3 2 1
1 1 0 1 1 0 0 (receive data from sender)
p1=1,3,5,7  0101 p1=0 The data is corrupt or error.
p2=2,3,6,7  0111 p2=1 Convert binary data to decimal value. So, 2+4=6, the data
P3=4,5,6,7  1011 p4=1 corrupt or error at 6 position.

BCA Page 5
Networking 1 GZRSC 2021

There are various flow control protocols


which are classified as
For Noisy channels: 1.Stop and wait ARQ For Noiseless channels : Stop and wait
2.Go Back N ARQ
3.Selective Repeat ARQ
Stop and wait = one frame
Sliding window: more than one frame (Go
( Back N ARQ & Selective Repeat ARQ

For Noiseless channels : Stop and Wait Protocol


It is the simplest flow control method.
Sender : Sender sends a data packet to the receiver.
Sender stops and waits for the acknowledgement for the
sent packet from the receiver.
Receiver : Receiver receives and processes the data
packet.
Receiver sends an acknowledgement to the sender.
After receiving the acknowledgement, sender sends the
next data packet to the receiver.
Stop & Wait Protocol performs better for LANs
than WANs because the efficiency of the protocol is
inversely proportional to the distance between the sender
& receiver node and as we all know that the distance is
less in LANs as compared to WANs.
Disadvantages of Stop and Wait protocol
The following are the problems associated with a stop
and wait protocol:
1. Problems occur due to lost data
Suppose the sender sends the data and the data is lost.
The receiver is waiting for the data for a long time. Since the
data is not received by the receiver, so it does not send any
acknowledgment. Since the sender does not receive any
acknowledgment so it will not send the next packet. This
problem occurs due to the lost data.
In this case, two problems occur:

BCA Page 6
Networking 1 GZRSC 2021
Sender waits for an infinite amount of time for an acknowledgment.
Receiver waits for an infinite amount of time for a data.

2. Problems occur due to lost acknowledgment


Suppose the sender sends the data and it has also been
received by the receiver. On receiving the packet, the receiver
sends the acknowledgment. In this case, the acknowledgment
is lost in a network, so there is no chance for the sender to
receive the acknowledgment. There is also no chance for the
sender to send the next packet as in stop and wait protocol, the
next packet cannot be sent until the acknowledgment of the
previous packet is received.
In this case, one problem occurs:
Sender waits for an infinite amount of time for an acknowledgment.

3. Problem due to the delayed


elayed data or
acknowledgment
Suppose the sender sends the data and it has also
been received by the receiver. The receiver then sends the
acknowledgment but the acknowledgment is received after
the timeout period on the sender's side. As the
acknowledgment nt is received late, so acknowledgment can
be wrongly considered as the acknowledgment of some
other data packet.

Stop and Wait ARQ is an improved and modified version of


Stop and Wait protocol
protocol, the only difference is that
Working of Stop & Wait ARQ is almost like Stop & Wait protocol,
it includes some additional components, which are:
1.Time out timer
2.Sequence numbers for data packets
3.Sequence numbers for feedbacks

BCA Page 7
Networking 1 GZRSC 2021

Working of Stop and Wait ARQ:


1) Sender A sends a data
frame or packet with sequence
number 0.
2) Receiver B, after
receiving data frame, sends and
acknowledgement with sequence
number 1 (sequence number of
next expected data frame or
packet)
There is only one bit
sequence number that implies that
both sender and receiver have
buffer for one frame or packet
only.
Stop and wait ARQ is a
one bit sliding window protocol
where-Sender window size =
1,Receiver window size = 1
Thus, in stop and wait
ARQ,
Minimum number of sequence numbers required = Sender Window Size + Receiver Window
Size = 1 + 1= 2.The
The two sequence numbers used 0 and 1
It is an example for “Closed Loop OR connection oriented “ protocols
So Stop and Wait ARQ may work fine where propagation delay is very less for example LAN
connections, but performs badly for distant connections like satellite connection.
Limitations
The Stop & Wait ARQ is very less efficient because the sender window size is 1, which
allows the sender to keep only one frame without feedback. So, the sender sends a data packet and
waits for the feedback, and it gets the feedback it sends another data packet.

Sliding Window Protocol


The sliding window is a technique for sending multiple frames at a time. It controls the data
packets between the two devices where reliable and gradual delivery of data frames is needed. It is
also used in TCP (Transmission Control Protocol).
Protocol)

BCA Page 8
Networking 1 GZRSC 2021
In this
is technique, each frame has sent from the sequence number. The sequence numbers are
used to find the missing data in the receiver end. The
purpose of the sliding window technique is to avoid
duplicate data, so it uses the sequence number.

Go-Back-N ARQ

Go-Back-N N ARQ protocol is also known as Go- Go


Back-N N Automatic Repeat Request. It is a data link
layer protocol that uses a sliding window method. In
this, if any frame is corrupted or lost, all subsequent
frames have to be sent again.

The size of the sender window is N in this protocol.


For example, Go-Back-8, 8, the size of the sender
window, will be 8. The receiver window size is
always 1.

If the receiver receives a corrupted frame, it cancels


it. The receiver does not accept a corrupted frame.
When the timer expires, the sender sends the correct
frame again.

Example.There are 11 frames to be sent.

Frames are represented as 0,1,2,3,4,5,6,7,8,9,10

Window size as 4 (the 4 frames can be sent at a time


before expecting the acknowledgment of the first
frame.)

Step 1: Firstly, the sender will send the first four


frames to the receiver, i.e., 0,1,2,3, and now the
sender is expected to receive the acknowledgment of
the 0th frame.

the receiver has sent the acknowledgment for the 0


frame, and the receiver has successfully
ssfully received it.

Step 2:The
The sender will then send the next frame, i.e.,
4, and the window slides containing four frames
(1,2,3,4).

The receiver will then send the acknowledgment for


the frame no 1. After receiving the acknowledgment,
the sender will send
nd the next frame, i.e., frame no 5,
and the window will slide having four frames
(2,3,4,5).

BCA Page 9
Networking 1 GZRSC 2021
The receiver is not acknowledging the frame no 2, either the frame is lost, or the acknowledgment is
lost. Instead of sending the frame no 6, the sender Go-Back to 2, which is the first frame of the
current window, retransmits all the frames in the current window, i.e., 2,3,4,5.

In Go back N, sender window size is N and receiver window size is always 1.

In Go back N,
Sender window size = N. Example in Go back 10, sender window size will be 10.
Receiver window size is always 1 for any value of N.

Selective Repeat ARQ


Selective Repeat ARQ is also known as the Selective Repeat Automatic Repeat Request. It is
a data link layer protocol that uses a
sliding window method. The Go-back-N
ARQ protocol works well if it has fewer
errors. But if there is a lot of error in the
frame, lots of bandwidth loss in sending
the frames again. So, we use the
Selective Repeat ARQ protocol.

In this protocol, the size of the sender


window is always equal to the size of the
receiver window. The size of the sliding
window is always greater than 1.

If the receiver receives a corrupt frame, it


does not directly discard it. It sends a
negative acknowledgment to the sender.
The sender sends that frame again as
soon as on the receiving negative
acknowledgment. There is no waiting for
any time-out to send that frame.

In SR protocol,
Sender window size = Receiver window
size
The size is of course greater than 1
otherwise the protocol will become Stop
and Wait ARQ.
If n bits are available for sequence
numbers, then-
Sender window size = Receiver window
size = 2n/2 = 2n-1
Receiver acknowledges each frame
independently.
As receiver receives a new frame from the sender, it sends its acknowledgement.
If receiver receives a frame that is corrupted, then it does not silently discard that frame.

BCA Page 10
Networking 1 GZRSC 2021
Receiver handles the situation efficiently by sending a negative acknowledgement (NACK).
Negative acknowledgement allows early retransmission of the corrupted frame.
It also avoids waiting for the time out timer to expire at the sender side to retransmit the frame.

PPP (framing, transition phase only).


Point-to-Point Protocol (PPP) Frame Format
Point-to-Point Protocol (PPP) is generally the default RAS protocol in Windows and is most
commonly used protocol of data link layer that is required to encapsulate higher network-layer
protocols simply to pass over synchronous and asynchronous communication lines. In PPP, link
establishment is controlled and handled mainly by Link Control Protocol (LCP). It is also required to
connect the Home PC to server of ISP through a modem. It was also adopted by ISPs to simply
provide dial-up Internet Access.
PPP Frame Format
The frame format of PPP resembles HDLC frame. Its various fields are:

1. Flag field: Flag field marks the beginning and end of the PPP frame. Flag byte is
01111110. (1 byte).

2. Address field: This field is of 1 byte and is always 11111111. This address is the
broadcast address i.e. all the stations accept this frame.

3. Control field: This field is also of 1 byte. This field uses the format of the U-frame
(unnumbered) in HDLC. The value is always 00000011 to show that the frame does
not contain any sequence numbers and there is no flow control or error control.

4. Protocol field: This field specifies the kind of packet in the data field i.e. what is
being carried in data field.

5. Data field: Its length is variable. If the length is not negotiated using LCP during line
set up, a default length of 1500 bytes is used. It carries user data or other information.

6. FCS field: The frame checks sequence. It is either of 2 bytes or 4 bytes. It contains the
checksum.

BCA Page 11
Networking 1 GZRSC 2021

Transition Phases in PPP


The PPP connection goes through different states as shown in fig.
1.Dead: In dead phase the link is not used. There is no active carrier and the line is
quiet.

2.Establish: Connection goes into this phase when one of the nodes start
communication. In this phase, two parties negotiate the options. If negotiation is
successful, the system goes into authentication phase or directly to networking phase.
LCP packets are used for this purpose.

3. Authenticate: This phase is optional. The two nodes may decide during the
establishment phase, not to skip this phase. However if they decide to proceed with
authentication, they send several authentication packets. If the result is successful, the
connection goes to the networking phase; otherwise, it goes to the termination phase.

4. Network: In network phase, negotiation for the network layer protocols takes place.
PPP specifies that two nodes establish a network layer agreement before data at the
network layer can be exchanged. This is because PPP supports several protocols at
network layer. If a node is running multiple protocols simultaneously at the network
layer, the receiving node needs to know which protocol will receive the data.

5. Open: In this phase, data transfer takes place. The connection remains in this phase
until one of the endpoints wants to end the connection.

6. Terminate: In this phase connection is terminated.

BCA Page 12

You might also like