You are on page 1of 46

Topic No 3.

Link Layer Communication


3.1 Error detection and correction techniques

Error Detection:-
Error:- A condition when the receiver’s information does not match
with the sender’s information. During transmission, digital signals
suffer from noise that can introduce errors in the binary bits travelling
from sender to receiver. That means a 0 bit may change to 1 or a 1 bit
may change to 0.
Error Detecting Codes (Implemented either at Data link layer or
Transport Layer of OSI Model):- Whenever a message is
transmitted, it may get scrambled by noise or data may get corrupted.
we use error-detecting codes which are additional data added to a
given digital message to help us detect if any error has occurred
during transmission of the message.

2
3.1 Error detection and correction techniques

• Basic approach used for error detection is the use of redundancy bits,
where additional bits are added to facilitate detection of errors.
• Following are some popular techniques for error detection :
1. Simple Parity check
2. Two-dimensional Parity check
3. Checksum
4. Cyclic redundancy check

3
3.1 Error detection and correction techniques

1. Single Parity check


Blocks of data from the source
are subjected to a check bit or
parity bit generator form, where
a parity of :
1 is added to the block if it
contains odd number of 1’s, and
0 is added if it contains even
number of 1’s
This scheme makes the total
number of 1’s even, that is why
it is called even parity checking.
3.1 Error detection and correction techniques

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.
3.1 Error detection and correction techniques

2. Two-dimensional
Parity check:-
Parity check bits are
calculated for each row,
which is equivalent to a
simple parity check bit.
Parity check bits are
also calculated for all
columns, then both are
sent along with the data.
At the receiving end
these are compared with
the parity bits calculated
on the received data.
3.1 Error detection and correction techniques

3. Checksum
4. In checksum error detection scheme, the data is divided into k
segments each of m bits.
5. In the sender’s end the segments are added using 1’s complement
arithmetic to get the sum. The sum is complemented to get the
checksum.
6. The checksum segment is sent along with the data segments.
7. At the receiver’s end, all received segments are added using 1’s
complement arithmetic to get the sum. The sum is complemented.
8. If the result is zero, the received data is accepted; otherwise
discarded.
3.1 Error detection and correction techniques
3.1 Error detection and correction techniques

Error Correction
Error correction can be done in two ways:
1. Backward Error Correction When the receiver detects an error in
the data received, it requests back the sender to retransmit the data
unit.
2. Forward Error Correction When the receiver detects some error
in the data received, it executes error-correcting code, which helps it
to auto-recover and to correct some kinds of errors.
Backward Error Correction, is simple and can only be efficiently used
where retransmitting is not expensive. For example, fiber optics. But in
case of wireless transmission retransmitting may cost too much. So
Forward Error Correction is used.
3.2 Framing and its types
3.2 Framing and its types
3.2 Framing and its types
3.2 Framing and its types
3.2 Framing and its types
3.2 Framing and its types
3.2 Framing and its types
3.2 Framing and its types
3.2 Framing and its types
3.2 Framing and its types
3.2 Framing and its types
3.3 Flow and error control

Flow Control:
When a data frame (Layer-2 data) is sent from one host to another over a
single medium, it is required that the sender and receiver should work at
the same speed. Sender sends at a speed on which the receiver can
process and accept the data. What if the speed (hardware/software) of the
sender or receiver differs? If sender is sending too fast the receiver may
be overloaded, (swamped) and data may be lost.
Two types of mechanisms can be deployed to control the flow:
1. Stop and Wait
2. Sliding Window
3.3 Flow and error control

Flow Control:
1. Stop and Wait
This flow control mechanism forces
the sender after transmitting a data
frame to stop and wait until the
acknowledgement of the data-frame
sent is received.
Advantage of Stop-and-wait
The Stop-and-wait method is simple as
each frame is checked and
acknowledged before the next frame is
sent.
3.3 Flow and error control

Disadvantages of 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:


• Sender waits for an infinite amount of time for an acknowledgment.
• Receiver waits for an infinite amount of time for a data.
3.3 Flow and error control

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 and if 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.3 Flow and error control

3. Problem due to the delayed 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 is received late, so acknowledgment can be
wrongly considered as the acknowledgment of some other data packet.
3.3 Flow and error control

Stop and Wait ARQ (Automatic Repeat Request)


These Lost data, Lost acknowledgment and delayed data or
acknowledgment are resolved by Stop and Wait ARQ (Automatic Repeat
Request) that does both error control and flow control.
1. Time Out:
3.3 Flow and error control

Stop and Wait ARQ (Automatic Repeat Request)


2. Sequence Number (Data):

3. Delayed Acknowledgement:
This is resolved by introducing sequence number for acknowledgement
also.
3.3 Flow and error control
Flow Control: 2. Sliding Window
1 4

2 5

3 6
3.3 Flow and error control

Flow Control:
2. Sliding Window
7
3.3 Flow and error control

The Sliding Window ARQ (Automatic Repeat reQuest) protocols are of


two categories −

1. Go – Back – N ARQ:- This provides for sending multiple frames


before receiving the acknowledgment for the first frame. It uses the
concept of sliding window, and so is also called sliding window
protocol. The frames are sequentially numbered and a finite number of
frames are sent. If the acknowledgment of a frame is not received within
the time period, all frames starting from that frame are retransmitted.
3.3 Flow and error control

1. Go – Back – N ARQ:-
3.3 Flow and error control

1. Go – Back – N ARQ:-
3.3 Flow and error control

2. Selective Request ARQ:- This protocol also provides for sending


multiple frames before receiving the acknowledgment for the first frame.
However, here only the erroneous or lost frames are retransmitted, while
the good frames are received and buffered..
3.4 HDLC Protocol

• HDLC (High-Level Data Link Control) is a bit-oriented


protocol that is used for communication over the point-to-point
and multipoint links. This protocol implements the mechanism
of ARQ(Automatic Repeat Request). With the help of the
HDLC protocol, full-duplex communication is possible.
• HDLC is the most widely used protocol and offers reliability,
efficiency, and a high level of Flexibility.
3.4 HDLC Protocol

In order to make the HDLC protocol applicable for various


network configurations, there are three types of stations as
follows:
1. Primary Station: In the case of the communication between
the primary and secondary station; it is the responsibility of the
primary station to connect and disconnect the data link. The
frames issued by the primary station are commonly known
as commands.
2. Secondary Station: The secondary station operates under the
control of the primary station. The Frames issued by the
secondary stations are commonly known as responses.
3. Combined Station The combined station acts as both Primary
stations as well as Secondary stations. The combined station
issues both commands as well as responses.
3.4 HDLC Protocol

HDLC supports two types of transfer modes


Transfer Modes

Normal Response Asynchronous


Mode (NRM) Balanced Mode (ABM)

1. Normal Response Mode (NRM)


primary station that send commands and secondary station that can
respond to received commands. It is used for both point - to - point and
multipoint communications.
3.4 HDLC Protocol
3.4 HDLC Protocol

2. Asynchronous Balanced Mode (ABM) − Here, the configuration is


balanced, i.e. each station can both send commands and respond to
commands. It is used for only point - to - point communications.
3.4 HDLC Protocol

HDLC Frame
HDLC is a bit - oriented protocol where each frame contains up to six fields.
The structure varies according to the type of frame.

Flag − It is an 8-bit sequence that marks the beginning and the end of the
frame. The bit pattern of the flag is 01111110.
Address − It contains the address of the receiver. If the frame is sent by the
primary station, it contains the address(es) of the secondary station(s). If it is
sent by the secondary station, it contains the address of the primary station.
The address field may be from 1 byte to several bytes.
Control − It is 1 or 2 bytes containing flow and error control information.
Payload − This carries the data from the network layer. Its length may vary
from one network to another.
FCS − It is a 2 byte or 4 bytes frame check sequence for error detection. The
standard code used is CRC (cyclic redundancy code)
3.4 HDLC Protocol
3.4 HDLC Protocol

Types of HDLC Frames


There are three types of HDLC frames. The type of frame is determined by
the control field of the frame −
1. I-frame − I-frames or Information frames carry user data from the
network layer. They also include flow and error control information that
is attached on user data. The first bit of control field of I-frame is 0.

2. S-frame − S-frames or Supervisory frames do not contain information


field. They are used for flow and error control. The first two bits of
control field of S-frame is 10.

3. U-frame − These frames are mainly reserved for system management.


These frames are used for exchanging control information between the
communicating devices. The first two bits of control field of U-frame is
11.
3.4 HDLC Protocol
3.4 HDLC Protocol

Features of HDLC Protocol


1. This protocol uses bits to stuff flags occurring in the data.
2. This protocol is used for point-to-point as well as multipoint
link access.
3. HDLC is one of the most common protocols of the data link
layer.
4. HDLC is a bit-oriented protocol.
5. This protocol implements error control as well as flow control.
3.5 P2P Protocol

P2P Protocol:-
It stands for "Peer to Peer." In a P2P network, the "peers" are computer
systems which are connected to each other via the Internet. Files can be
shared directly between systems on the network without the need of a
central server. In other words, each computer on a P2P network becomes
a file server as well as a client.
3.5 P2P Protocol
Assignment No.3
Sub- Network Technology
Q.1. Explain the following error detection and correction
techniques in detail.
1. Simple Parity Check
2. Two Dimensional Parity check
3. Checksum
4. Cyclic Redundancy check(CRC)
Q.2. Explain Framing and its types.
Q.3. Explain character-oriented protocol and Bit-oriented
Protocol in detail.
Q.4. Explain following flow and error control method in
detail.
5. Stop and Wait
6. Sliding Window
Q.5. Explain HDLC Protocol in detail.
Q.6. Explain Point to Point Protocol in detail.

You might also like