CSEN1071 Data Communications
Syllabus
UNIT - IV:
Digital Data Communication Techniques: Asynchronous and synchronous transmission,
types of errors, error detection techniques, error correction techniques (single bit)
Data link control protocols: Flow control, error control, high level data link control
(HDLC) protocol.
DR. GANESHKUMAR N, DEPT. OF CSE 2
Introduction
Synchronization:
For two devices linked by a transmission medium to exchange data, a high degree of
cooperation agreement between the two sides is required known as synchronization.
Two techniques for controlling this timing are:
1. Asynchronous transmission
2. Synchronous transmission
DR. GANESHKUMAR N, DEPT. OF CSE 3
Asynchronous transmission (character oriented)
In asynchronous transmission, each character of data is treated independently.
Here data are transmitted one character at a time, where each character is five to eight bits in
length.
Timing only needs maintaining within each character
NRZ-L signal encoding technique is used for asynchronous transmission, so it leads to loss of
synchronization for long sequence of 0’s and 1’s.
DR. GANESHKUMAR N, DEPT. OF CSE 4
DR. GANESHKUMAR N, DEPT. OF CSE 5
Advantages:
Asynchronous transmission is simple and cheap
Disadvantages:
 Asynchronous transmission leads to Framing Error.
 Long sequence of zeroes or one’s leads to loss of synchronization.
 Asynchronous transmission requires an overhead of two to three bits per character.
DR. GANESHKUMAR N, DEPT. OF CSE 6
Synchronous Transmission: (Bit Oriented or Byte
oriented)
Block of data transmitted without start or stop bits
The block may be a bit or many bits in length .
With synchronous transmission, it allows the receiver to determine the beginning and end of a
block of data.
To achieve this, each block begins with a preamble bit pattern(8-bit flag) and generally ends
with a postamble bit pattern(flag).
The data including preamble, postamble, and control information are called a frame.
DR. GANESHKUMAR N, DEPT. OF CSE 7
 The frame starts with a preamble called a flag, which is 8 bits long. The same flag is used as a
postamble.
 The receiver looks for the occurrence of the flag pattern to signal the start of a frame.
 This is followed by some number of control fields
Synchronous Frame Format
Advantages:
 For sizable blocks of data, synchronous transmission is far more efficient than asynchronous.
 Avoids loss of synchronization by using Manchester and differential Manchester encoding
mechanisms.
DR. GANESHKUMAR N, DEPT. OF CSE 8
Example
One of the more common schemes of Data Link Control contains 48 bits of control,
preamble, and postamble.
Thus, for a 1000-character block of data, each frame consists of 48 bits of overhead and
1000x8=8000 bits of data, for a percentage overhead of only (48/8048) * 100= 0.6%.
So, by this synchronous transmission overhead is 0.6% which is much lesser than 20% in
asynchronous transmission.
DR. GANESHKUMAR N, DEPT. OF CSE 9
Types of Errors
 An error occurs when a bit is altered between transmission and reception.
 Two general types of errors can occur
1. Single-bit errors and
2. Burst errors
DR. GANESHKUMAR N, DEPT. OF CSE 10
A single-bit error
It is an isolated error condition that alters one bit but does not affect nearby bits.
The term single-bit error means that only 1 bit of a given data unit (such as a byte, character,
or packet) is changed from 1 to 0 or from 0 to 1.
Eg: data before transmission-00001010 ,data in reception-00000010 only one bit is changed.
DR. GANESHKUMAR N, DEPT. OF CSE 11
A burst error
A burst error means that 2 or more bits in the data unit
have changed.
The term burst error means that 2 or more bits in the
data unit have changed from 1 to 0 or from 0 to 1.
Length of Burst Error B is a contiguous sequence of B
bits in which the first and last bits and any number of
intermediate bits are received in error.
Due to impulse noise a burst error occurs
DR. GANESHKUMAR N, DEPT. OF CSE 12
The duration of noise is normally longer than the duration of 1 bit, which means that when
noise affects data, it affects a set of bits.
The number of burst bits affected depends on the data rate and duration of noise.
For example,1.if we are sending data at 10 Mbps, a noise of 1micro second can affect 10 bits;
if we are sending data at 100 Mbps, the same noise can affect 100bits,i.e., there is an error burst
of 100 bits.
DR. GANESHKUMAR N, DEPT. OF CSE 13
Redundancy
The central concept in detecting or correcting errors is redundancy.
To be able to detect or correct errors, we need to send some extra bits with our data.
These redundant bits (called error detection code) are added by the sender and removed by
the receiver.
To detect or correct errors, we need to send extra bits i.e., error detection code(redundant
bits) with data.
DR. GANESHKUMAR N, DEPT. OF CSE 14
Error Detection Techniques
Regardless of the design of the transmission system, there will be errors during transmission from sender to
receiver, resulting in the change of one or more bits in a transmitted frame.
Error Detecting Principle:
For a given frame of bits, additional bits that constitute an error-detecting code are added by the transmitter.
This code is calculated as a function of the transmitted bits.
Typically, for a data block of k bits, the error-detecting algorithm yields an error-detecting code of n-k bits,
where n-k <k.
The error-detecting code, also referred to as the check bits, is appended to the data block to produce a frame
of n bits, which is then transmitted.
DR. GANESHKUMAR N, DEPT. OF CSE 15
Error Detection Process
DR. GANESHKUMAR N, DEPT. OF CSE 16
Parity Check
 The simplest error-detecting scheme (Parity check) is to append a parity bit to the end of a
block of data.
 Two types of parity checks have been used
1. Odd Parity
2. Even Parity
Even Parity
The parity bit is set(add or append) by the transmitter such that the total number of ones
in the character, has become an even number of 1s means even parity.
If the number of 1’s is not even at the receiver side, receiver can detect the error in the
transmission.
DR. GANESHKUMAR N, DEPT. OF CSE 17
Odd Parity:
The parity bit is set by the transmitter such that the total number of ones in the character, has
become an odd number of 1s means odd parity.
If the number of 1’s is not odd at the receiver side, receiver can detect the error in the
transmission.
Eg: Input before transmission- (1110001),
 Using even parity -11100010 [0 is appened]
 Using odd parity -11100011 [1 is appened]
DR. GANESHKUMAR N, DEPT. OF CSE 18
Cyclic Redundancy Check (CRC)
A Cyclic Redundancy Check (CRC) is an error-detecting code. Blocks of data entering these
systems get a short check value attached (Frame Check Sequence), based on the remainder of a
polynomial of their contents.
Given a k-bit block of bits, or message, the transmitter generates an n-k bit sequence, known as a
frame check sequence (FCS), [such that the resulting frame, consisting of n bits, is exactly
divisible by some predetermined number.(P = n-k+1)
The receiver then divides the incoming frame by that predetermined number and, if there is no
remainder, assumes there was no error.
To clarify this, we present the procedure in three equivalent ways: modulo 2 arithmetic,
polynomials, and digital logic.
DR. GANESHKUMAR N, DEPT. OF CSE 19
Modulo 2 Arithmetic:
Modulo 2 arithmetic uses binary addition with no carries, which is just the exclusive-OR (XOR)
operation. Binary subtraction with no carries is also interpreted as the XOR operation: For
example,
DR. GANESHKUMAR N, DEPT. OF CSE 20
Example:
DR. GANESHKUMAR N, DEPT. OF CSE 21
Polynomials
 A second way of viewing the CRC process is to express all values as polynomials in a dummy
variable X, with binary coefficients.
 The coefficients correspond to the bits in the binary number. Thus, for D = 110011, we have
D(X) = X5 + X4 + X + 1, and for P = 11001, we have P(X) = X4 + X3 + 1.
 The CRC process can now be described as T(X) = Xn-k D(X) + R(X)
Example CRC implemented in polynomial
DR. GANESHKUMAR N, DEPT. OF CSE 22
Here k=10 (number of bits in D(X)),
P= n-k+1=6 (Pattern p=n-k+1) so n-10+1=6
For D=1010001101, we have D(X)=X9+X7+X3+X2+1. And for P=110101 we have P(X)=X5+X4+X2+1. n=6+10-1=15,
FCS(n-k=15-10=5)
The message D is multiplied with Xn-k. So D(X) multiplied with X5.
[ X5 *D(X) =X5*(X9+X7+X3+X2+1) = X14+X12 +X8 +X7+ X5
The product is divided by P.[P(X)=X5+X4+X2+1].
After the polynomial division, it end up with remainder R= 01110 which corresponds to X3+X2+X1
The message is transmitted as n= X14+X12 +X8 +X7+ X5 + X3+X2+X1
Again the transmitted message is divided by pattern P(X) at the receiver’s side, if it is no remainder then it is called as
error free transmission.
DR. GANESHKUMAR N, DEPT. OF CSE 23
Figure 6.4 Example of Polynomial Division
DR. GANESHKUMAR N, DEPT. OF CSE 24
Digital Logic Implementation
The CRC process can be implemented by, a circuit consisting of XOR gates and a shift register.
The shift register is a string of 1-bit storage devices. The entire register is clocked
simultaneously, causing a 1-bit shift along the entire register.
The circuit is implemented as follows:
 The number of shift registers, equal to the length of the FCS (n-k bits).
 There are up to n-k XOR gates.
 The presence or absence of a gate corresponds to the presence or absence of a term in the
divisor polynomial, P(X), excluding the terms 1 and Xn-k.
 Again the transmitted message is divided by pattern P(X) at the receiver’s side, if it is no
remainder then it is called as error free transmission.
DR. GANESHKUMAR N, DEPT. OF CSE 25
Digital Logic Implementation
With the input 1010001101
Circuit with Shift Registers for dividing by the polynomial X5 + X4 + X2+ 1
XZ
DR. GANESHKUMAR N, DEPT. OF CSE 26
C4 C3 C2 C1 C0 C4 ⊕ C3 ⊕ I C4 ⊕ C1 ⊕ I C4 ⊕ I I
Initial 0 0 0 0 0 1 1 1 1
Step 1 1 0 1 0 1 1 1 1 0
Step 2 1 1 1 1 1 1 1 0 1
Step 3 1 1 1 1 0 0 0 1 0
Step 4 0 1 0 0 1 1 0 0 0
Step 5 1 0 0 1 0 1 0 1 0
Step 6 1 0 0 0 1 0 0 0 1
Step 7 0 0 0 1 0 1 0 1 1
Step 8 1 0 0 0 1 1 1 1 0
Step 9 1 0 1 1 1 0 1 0 1
Step 10 0 1 1 1 0
Example with input of 1010001101
DR. GANESHKUMAR N, DEPT. OF CSE 27
Error Correction
There are two approaches
Backward Error correction: When an error is detected in a frame, the sender is asked to
retransmit the data/frame. This is known as Automatic Repeat request (ARQ).
 Eg: Stop-and-wait ARQ, Go-back N ARQ, Selective Repeat ARQ
Forward Error Correction: Use more redundancy in the transmitted data to not only detect
but to correct error in the received data.
 Eg: Hamming code.
DR. GANESHKUMAR N, DEPT. OF CSE 28
Error correction process
Error Correction Process
DR. GANESHKUMAR N, DEPT. OF CSE 29
Hamming Distance
The Hamming distance between two words is the number of differences between corresponding
bits.
The Hamming distance d(v1, v2) between two n-bit binary sequences v1 and v2 is the
number of bits in which v1 and v1 disagree.
For example, if v1 = 011011, v2 = 110001
then d(v1, v2) = 3
Now let us consider the block code technique for error correction. Suppose we wish to
transmit blocks of data of length k bits. Instead of transmitting each block as k bits, we
map each k-bit sequence into a unique n-bit codeword.
DR. GANESHKUMAR N, DEPT. OF CSE 30
Example:
For n=2, k=5 the following assignment is made
Suppose that a codeword block is received with the bit pattern 00100.This is not a valid
codeword, and so the receiver has detected an error.
DR. GANESHKUMAR N, DEPT. OF CSE 31
Disadvantage:
It is not true that for every invalid codeword there is one and only one valid codeword at a
minimum distance.
There are 25=32 possible codewords of which 4 are valid, leaving 28 invalid codewords.
Redundancy of the code:
With an (n, k) block code, there are valid codewords out of a total of 2n possible
codewords.
The ratio of redundant bits to data bits, (n-k)/k is called the redundancy of the code,
and the ratio of data bits to total bits, k/n, is called the code rate.
The code rate is a measure of how much additional bandwidth is required to carry data
at the same data rate as without the code.
DR. GANESHKUMAR N, DEPT. OF CSE 32
HAMMING CODE
Hamming code can be applied to data units of any length and uses the relationship between the
data bits and redundant bits.
To calculate the numbers of redundant bits (k) required to correct d data bits, the condition is 2k
>= m + k + 1 where m is data bit.
Basic Approach:
To each group of m information bits k parity bits are added to form (m+k) bit code.
Location of each of the (m+k) digits is assigned a decimal value.
The k parity bits are placed in positions 1, 2, …, 2k-1 positions(powers of 2 ).
k parity checks are performed on selected digits of each codeword.
At the receiving end the parity bits are recalculated. The decimal value of the k parity bits
provides the bit-position in error, if any. Figure shows how hamming code is used for correction
for 4-bit numbers (d4d3d2d1) with the help of three redundant bits (r3r2r1) for the data bits 1010.
DR. GANESHKUMAR N, DEPT. OF CSE 33
DR. GANESHKUMAR N, DEPT. OF CSE 34
DATA LINK CONTROL PROTOCOLS
DATA LINK CONTROL PROTOCOLS
First, Data link control, deals with the design and procedures for communication
between two adjacent nodes: node-to-node communication.
The second function of the data link layer is media access control, or how to
share the link.
DR. GANESHKUMAR N, DEPT. OF CSE 36
Need for data link control
1.Frame synchronization (Beginning and End of frame)
2.Flow control ( sender shouldn’t send faster than receiver capacity)
3.Error control (EC+ED)
4.Addressing (Identity of S and R)
5.Control and data on same link( No physically separation link for control and
data info)
6.Link management (coordination and cooperation)
DR. GANESHKUMAR N, DEPT. OF CSE 37
Flow Control
Flow control is a technique for assuring that a transmitting entity does not
overwhelm a receiving entity with data.
The receiving entity typically allocates a data buffer of some maximum length for
a transfer.
When data are received, the receiver must do a certain amount of processing before
passing the data to the higher-level software.
In the absence of flow control, the receiver’s buffer may fill up and overflow while
it is processing old data.
DR. GANESHKUMAR N, DEPT. OF CSE 38
Model of frame transmission
DR. GANESHKUMAR N, DEPT. OF CSE 39
Flow Control
The time it takes for a station to emit all of the bits of a frame onto the medium is
the transmission time; this is proportional to the length of the frame.
The propagation time is the time it takes for a bit to traverse the link between
source and destination.
DR. GANESHKUMAR N, DEPT. OF CSE 40
Stop-and-Wait Flow Control
The simplest form of flow control, known as stop-and-wait flow control, works as
follows:
A source entity transmits a frame.
After the destination entity receives the frame, it indicates its willingness to accept
another frame by sending back an acknowledgment to the frame just received.
The source must wait until it receives the acknowledgment before sending the next
frame.
The destination can thus stop the flow of data simply by withholding
acknowledgment.
It is often the case that a source will break up a large block of data into smaller
blocks and transmit the data in many frames.
DR. GANESHKUMAR N, DEPT. OF CSE 41
Contd..
This is done for the following reasons:
• The buffer size of the receiver may be limited.
• The longer the transmission, the more likely that there will be an error, necessitating
retransmission of the entire frame.
• With smaller frames, errors are detected sooner, and a smaller amount of data needs
to be retransmitted.
• On a shared medium, such as a LAN, it is usually desirable not to permit one station
to occupy the medium for an extended period, thus causing long delays at the other
sending stations.
DR. GANESHKUMAR N, DEPT. OF CSE 42
DR. GANESHKUMAR N, DEPT. OF CSE 43
Drawbacks
Delayed
Acknowledgement/Data:
After a timeout on the sender
side, a long-delayed
acknowledgement might be
wrongly considered as
acknowledgement of some other
recent packet.
DR. GANESHKUMAR N, DEPT. OF CSE 44
The term Sliding Windows refers to imaginary boxes to hold frames.
Efficiency of link can be greatly improved by allowing multiple frames to be in
transit at the same time.
A maintains a list of sequence numbers that it is allowed to send, and B maintains
a list of sequence numbers that it is prepared to receive.
Each of these lists can be thought of as a window of frames. The operation is
referred to as sliding-window flow control.
The sequence number to be used occupies a field in the frame; it is limited to a
range of values.
Sliding-Window Flow Control
DR. GANESHKUMAR N, DEPT. OF CSE 45
Example
For a 3-bit field, the sequence number can range from 0 to 7.
Accordingly, frames are numbered modulo 8; that is, after sequence number 7, the next
number is 0.
For a k-bit field the range of sequence numbers is 0 through 2k-1 and frames are
numbered modulo 2k.
The maximum window size is 2k-1.
It assumes the use of a 3-bit sequence number, so that frames are numbered
sequentially from 0 through 7, and then the same numbers are reused for subsequent
frames.
DR. GANESHKUMAR N, DEPT. OF CSE 46
DR. GANESHKUMAR N, DEPT. OF CSE 47
DR. GANESHKUMAR N, DEPT. OF CSE 48
 The example assumes a 3-bit sequence number field and a maximum window size of
seven frames.
 Initially, A and B have windows indicating that A may transmit seven frames, beginning
with frame 0 (F0).
 After transmitting three frames (F0, F1, F2) without acknowledgment, A has shrunk its
window to four frames and maintains a copy of the three transmitted frames.
 The window indicates that A may transmit four frames, beginning with frame number 3.
 B then transmits an RR (receive ready) 3, which means “I have received all frames up
through frame number 2 and am ready to receive frame number 3; in fact, I am prepared to
receive seven frames, beginning with frame number 3.
DR. GANESHKUMAR N, DEPT. OF CSE 49
 With this acknowledgment, A is back up to permission to transmit seven frames, still
beginning with frame 3; also A may discard the buffered frames that have now been
acknowledged.
 A proceeds to transmit frames 3, 4, 5, and 6. B returns RR 4, which acknowledges
F3, and allows transmission of F4 through the next instance of F2.
 By the time this RR reaches A, it has already transmitted F4, F5, and F6, and
therefore A may only open its window to permit sending four frames beginning with
F7.
DR. GANESHKUMAR N, DEPT. OF CSE 50
Advantages
Sliding-window flow control is potentially much more efficient than stop-and
wait flow control.
The reason is that, with sliding-window flow control, the transmission link is
treated as a pipeline that may be filled with frames in transit.
DR. GANESHKUMAR N, DEPT. OF CSE 51
ERROR CONTROL
Error control refers to mechanisms to detect and correct errors that occur in the
transmission of frames.
There is a possibility of two types of errors:
1.Lost frame : A frame fails to arrive at the other side
2.Damaged frame : frame does arrive, but some of the bits are in error (have been altered
during transmission).
DR. GANESHKUMAR N, DEPT. OF CSE 52
The most common techniques for error control are based on some or all of the
following ingredients:
Error detection: Detecting whether there are corrupted bits in a frame.
Positive acknowledgment: The destination returns a positive acknowledgment to
successfully received, error-free frames.
Retransmission after timeout: The source retransmits a frame that has not been acknowledged
after a predetermined amount of time.
Negative acknowledgment and retransmission: The destination returns a negative
acknowledgment to frames in which an error is detected. The source retransmits such frames.
DR. GANESHKUMAR N, DEPT. OF CSE 53
Contd..
Three versions of ARQ or Three Error control techniques are:
1.Stop-and-wait ARQ
2.Go-back-N ARQ
3.Selective-reject ARQ
DR. GANESHKUMAR N, DEPT. OF CSE 54
Stop-and-Wait ARQ
Stop-and-wait ARQ is based on the stop-and-wait flow control technique.
DR. GANESHKUMAR N, DEPT. OF CSE 55
Stop-and-wait ARQ is based on the stop-and-wait flow control technique.
The source station transmits a single frame and then must await an acknowledgment
(ACK).
No other data frames can be sent until the destination station’s reply arrives at the source
station.
Two sorts of errors could occur. First (damaged frame), the frame that arrives at the
destination could be damaged.
The receiver detects this by using the error-detection technique referred to earlier and
simply discard the frame
DR. GANESHKUMAR N, DEPT. OF CSE 56
Station A sends a frame.
The frame is received correctly by station B, which responds with an acknowledgment (ACK).
The ACK is damaged in transit and is not recognizable by A, which will therefore time out and
resend the same frame.
This duplicate frame arrives and is accepted by B.
B has therefore accepted two copies of the same frame as if they were separate.
DR. GANESHKUMAR N, DEPT. OF CSE 57
To avoid this problem, frames are alternately labeled with 0 or 1, and
◦ positive acknowledgments are of the form ACK0 (acknowledges receipt of a frame
numbered 1 and indicates that the receiver is ready for a frame numbered 0) and
◦ ACK1 (acknowledges receipt of a frame numbered 0 and indicates that the receiver is
ready for a frame numbered 1).
DR. GANESHKUMAR N, DEPT. OF CSE 58
Advantage: Simplicity
Disadvantage:
Only one frame is sent at a time.
No Pipelining.
Efficiency is less.
DR. GANESHKUMAR N, DEPT. OF CSE 59
DR. GANESHKUMAR N, DEPT. OF CSE 60
DR. GANESHKUMAR N, DEPT. OF CSE 61
DR. GANESHKUMAR N, DEPT. OF CSE 62
DR. GANESHKUMAR N, DEPT. OF CSE 63
Go-Back-N ARQ
DR. GANESHKUMAR N, DEPT. OF CSE 64
Selective Reject ARQ
DR. GANESHKUMAR N, DEPT. OF CSE 65
DR. GANESHKUMAR N, DEPT. OF CSE 66
DR. GANESHKUMAR N, DEPT. OF CSE 67
DR. GANESHKUMAR N, DEPT. OF CSE 68
HDLC (High-level Data Link Control)
The most important data link control protocol is HDLC. HDLC is a bit-oriented
protocol for communication over point-to-point and multipoint links.
Basic Characteristics :
•HDLC defines three types of stations
•Two link configurations
•Three data transfer modes of operation.
DR. GANESHKUMAR N, DEPT. OF CSE 69
The three station types are :
1.Primary station : Controls operation of the link, Frames issued called commands
2.Secondary station :Operates under the control of the primary station, , Frames issued called
responses.
3.Combined station : Combines the features of primary and secondary
The two link configurations are :
1.Unbalanced configuration : Consists of one primary and one or more secondary
stations and supports both full-duplex and half-duplex transmission.
2.Balanced configuration : Consists of two combined stations and supports both full-
duplex and half-duplex transmission.
DR. GANESHKUMAR N, DEPT. OF CSE 70
Normal response mode (NRM)
Used with an unbalanced configuration.
The primary may initiate data transfer to a secondary, but a secondary may only transmit data
in response to a command from the primary.
NRM is used on multi-drop lines, in which a number of terminals are connected to a host
computer.
DR. GANESHKUMAR N, DEPT. OF CSE 71
Asynchronous balanced mode (ABM)
Used with a balanced configuration.
Either combined station may initiate transmission without receiving permission from the other
combined station.
ABM is the most widely used of the three modes; it makes more efficient use of a full-duplex
point-to-point link because there is no polling overhead.
DR. GANESHKUMAR N, DEPT. OF CSE 72
Asynchronous response mode (ARM)
Used with an unbalanced configuration.
The secondary may initiate transmission without explicit permission of the
primary.
The primary still retains responsibility for the line, including initialization, error
recovery, and logical disconnection.
DR. GANESHKUMAR N, DEPT. OF CSE 73
Frame Structure
HDLC uses synchronous transmission.
The flag, address, and control fields that precede the information field are
known as a header.
The FCS and flag fields following the data field are referred to as a trailer.
DR. GANESHKUMAR N, DEPT. OF CSE 74
Flag field
The flag field of an HDLC frame is an 8-bit sequence with the bit pattern 01111110 that
identifies both the beginning and the end of a frame and serves as a synchronization pattern for
the receiver.
There is no assurance that the pattern 01111110 will not appear somewhere inside the frame,
thus destroying synchronization.
To avoid this problem, a procedure known as bit stuffing is used.
 For all bits between the starting and ending flags, the transmitter inserts an extra 0 bit after
each occurrence of five 1s in the frame.
With the use of bit stuffing, arbitrary bit patterns can be inserted into the data field of the
frame. This property is known as data transparency.
DR. GANESHKUMAR N, DEPT. OF CSE 75
DR. GANESHKUMAR N, DEPT. OF CSE 76
DR. GANESHKUMAR N, DEPT. OF CSE 77
Contd..
When a pattern of five 1s appears, the sixth bit is examined.
If this bit is 0, it is deleted.
If the sixth bit is a 1 and the seventh bit is a 0, the combination is accepted as a
flag.
If the sixth and seventh bits are both 1, the sender is indicating an abort
condition.
DR. GANESHKUMAR N, DEPT. OF CSE 78
Address field
The second field of an HDLC frame contains the address of the secondary station.
If a primary station created the frame, it contains a to address. If a secondary creates the frame, it
contains a from address.
An address field can be 1 byte or several bytes long, depending on the needs of the network.
If the address field is only 1 byte, the last bit is always a 1.
 If the address is more than 1 byte, all bytes but the last one will end with 0; only the last will end
with 1.
Ending each intermediate byte with 0 indicates to the receiver that there are more address bytes
to come.
DR. GANESHKUMAR N, DEPT. OF CSE 79
Control field
The control field is a 1- or 2-byte segment of the frame used for flow and error
control.
HDLC defines three types of frames, each with a different control field format.
1. Information frames (I-frames)
2. Supervisory frames (S-frames)
3. Unnumbered frames (U-frames)
DR. GANESHKUMAR N, DEPT. OF CSE 80
Contd..
Information field:
The information field contains the user's data from the network layer or
management information. Its length can vary from one network to another.
FCS field:
The frame check sequence (FCS) is the HDLC error detection field. It can
contain either a 2- or 4-byte ITU-T CRC.
DR. GANESHKUMAR N, DEPT. OF CSE 81
Contd..
Control Field
The control field determines the type of frame and defines its functionality
as shown in below Fig
DR. GANESHKUMAR N, DEPT. OF CSE 82
Control Field for I-Frames
I-frames are designed to carry user data from the network layer.
1)The first bit defines the type. If the first bit of the control field is 0, this means
the frame is an I-frame.
2)The next 3 bits, called N(S), define the sequence number of the frame. With 3
bits, sequence number between 0 and 7 can be defined.
3)The last 3 bits, called N(R), correspond to the acknowledgment number when
piggybacking is used.
4)The single bit between N(S) and N(R) is called the PIF bit. The PIF field is a
single bit with a dual purpose. It has meaning only when it is set (bit = 1) and can
mean poll or final.
DR. GANESHKUMAR N, DEPT. OF CSE 83
Control Field for S-Frames
Supervisory frames are used for flow and error control whenever
piggybacking is either impossible or inappropriate (e.g., when the station either has
no data of its own to send or needs to send a command or response other than an
acknowledgment).
S-frames do not have information fields. If the first 2 bits of the control field
is 10, this means the frame is an S-frame.
The last 3 bits, called N(R), corresponds to the acknowledgment number
(ACK) or negative acknowledgment number (NAK) depending on the type of S-
frame.
DR. GANESHKUMAR N, DEPT. OF CSE 84
Contd..
•The 2 bits called code is used to define the type of S-frame itself. With 2 bits,
four types of S-frames, as described below:
Receive ready (RR) If the value of the code subfield is 00, it is an RR S-frame.
Receive not ready (RNR) If the value of the code subfield is 10,
Reject (REJ) If the value of the code subfield is 01,
Selective reject (SREJ) If the value of the code subfield is 11, it is an SREJ S-
frame.
DR. GANESHKUMAR N, DEPT. OF CSE 85
Control Field for U-Frames
Unnumbered frames are used to exchange session or link management and
control information between connected devices.
U-frames contain an information field, but one used for system management
information, not user data.
U-frame codes are divided into two sections: a 2-bit prefix before the P/F bit and
a 3-bit suffix after the P/F bit.
DR. GANESHKUMAR N, DEPT. OF CSE 86
HDLC frames
DR. GANESHKUMAR N, DEPT. OF CSE 87
HDLC Operation
HDLC operation consists of the exchange of I-frames, S-frames, and U-frames
between two stations.
The operation of HDLC involves three phases.
First, one side or another initializes the data link so that frames may be
exchanged in an orderly fashion. During this phase, the options that are to be used
are agreed upon.
Second, the two sides exchange user data and the control information to
exercise flow and error control.
Finally, one of the two sides signals the termination of the operation
DR. GANESHKUMAR N, DEPT. OF CSE 88
Contd..
Initialization
Either side may request initialization by issuing one of the six set mode
commands.
This command serves three purposes:
1. It signals the other side that initialization is requested.
2. It specifies which of the three modes (NRM, ABM, and ARM) is requested.
3. It specifies whether 3- or 7-bit sequence numbers are to be used.
If the other side accepts this request, then the HDLC module on that end transmits
an unnumbered acknowledged (UA) frame back to the initiating side.
DR. GANESHKUMAR N, DEPT. OF CSE 89
Data Transfer
When the initialization has been requested and accepted, then a logical connection is
established.
Both sides may begin to send user data in I-frames, starting with sequence number 0.
S-frames are also used for flow control and error control.
The receive ready (RR) frame acknowledges the last I-frame received by indicating the next I-
frame expected.
Disconnect
HDLC issues a disconnect by sending a disconnect (DISC) frame.
The remote entity must accept the disconnect by replying with a Un numbered Ack and
informing its layer 3 user that the connection has been terminated.
DR. GANESHKUMAR N, DEPT. OF CSE 90
DR. GANESHKUMAR N, DEPT. OF CSE 91
 The HDLC protocol entity for one side issues an SABM command to the other side
and starts a timer.
 The other side, upon receiving the SABM, returns a UA response.
 The logical connection is now active, and both sides may begin transmitting
frames.
 If the timer expire without a response to an SABM, the originator will repeat the
SABM, as illustrated.
 This would be repeated until a UA or DM is received or until, after a given number
of tries.
 The same figure shows the disconnect procedure. One side issues a DISC command
and the other responds with a UA response.
DR. GANESHKUMAR N, DEPT. OF CSE 92
 When an entity sends a number of I-frames in a row with no incoming data, then
the receive sequence number is simply repeated (e.g., I,1,1; I,2,1 in the A-to-B
direction).
 When an entity receives a number of I-frames in a row with no outgoing frames,
then the receive sequence number in the next outgoing frame must reflect the
cumulative activity (e.g., I,1,3 in the B-to-A direction).
 Note that, in addition to I-frames, data exchange may involve supervisory frames.
DR. GANESHKUMAR N, DEPT. OF CSE 93

Data Communications- Unit-4.pptx

  • 1.
  • 2.
    Syllabus UNIT - IV: DigitalData Communication Techniques: Asynchronous and synchronous transmission, types of errors, error detection techniques, error correction techniques (single bit) Data link control protocols: Flow control, error control, high level data link control (HDLC) protocol. DR. GANESHKUMAR N, DEPT. OF CSE 2
  • 3.
    Introduction Synchronization: For two deviceslinked by a transmission medium to exchange data, a high degree of cooperation agreement between the two sides is required known as synchronization. Two techniques for controlling this timing are: 1. Asynchronous transmission 2. Synchronous transmission DR. GANESHKUMAR N, DEPT. OF CSE 3
  • 4.
    Asynchronous transmission (characteroriented) In asynchronous transmission, each character of data is treated independently. Here data are transmitted one character at a time, where each character is five to eight bits in length. Timing only needs maintaining within each character NRZ-L signal encoding technique is used for asynchronous transmission, so it leads to loss of synchronization for long sequence of 0’s and 1’s. DR. GANESHKUMAR N, DEPT. OF CSE 4
  • 5.
    DR. GANESHKUMAR N,DEPT. OF CSE 5
  • 6.
    Advantages: Asynchronous transmission issimple and cheap Disadvantages:  Asynchronous transmission leads to Framing Error.  Long sequence of zeroes or one’s leads to loss of synchronization.  Asynchronous transmission requires an overhead of two to three bits per character. DR. GANESHKUMAR N, DEPT. OF CSE 6
  • 7.
    Synchronous Transmission: (BitOriented or Byte oriented) Block of data transmitted without start or stop bits The block may be a bit or many bits in length . With synchronous transmission, it allows the receiver to determine the beginning and end of a block of data. To achieve this, each block begins with a preamble bit pattern(8-bit flag) and generally ends with a postamble bit pattern(flag). The data including preamble, postamble, and control information are called a frame. DR. GANESHKUMAR N, DEPT. OF CSE 7
  • 8.
     The framestarts with a preamble called a flag, which is 8 bits long. The same flag is used as a postamble.  The receiver looks for the occurrence of the flag pattern to signal the start of a frame.  This is followed by some number of control fields Synchronous Frame Format Advantages:  For sizable blocks of data, synchronous transmission is far more efficient than asynchronous.  Avoids loss of synchronization by using Manchester and differential Manchester encoding mechanisms. DR. GANESHKUMAR N, DEPT. OF CSE 8
  • 9.
    Example One of themore common schemes of Data Link Control contains 48 bits of control, preamble, and postamble. Thus, for a 1000-character block of data, each frame consists of 48 bits of overhead and 1000x8=8000 bits of data, for a percentage overhead of only (48/8048) * 100= 0.6%. So, by this synchronous transmission overhead is 0.6% which is much lesser than 20% in asynchronous transmission. DR. GANESHKUMAR N, DEPT. OF CSE 9
  • 10.
    Types of Errors An error occurs when a bit is altered between transmission and reception.  Two general types of errors can occur 1. Single-bit errors and 2. Burst errors DR. GANESHKUMAR N, DEPT. OF CSE 10
  • 11.
    A single-bit error Itis an isolated error condition that alters one bit but does not affect nearby bits. The term single-bit error means that only 1 bit of a given data unit (such as a byte, character, or packet) is changed from 1 to 0 or from 0 to 1. Eg: data before transmission-00001010 ,data in reception-00000010 only one bit is changed. DR. GANESHKUMAR N, DEPT. OF CSE 11
  • 12.
    A burst error Aburst error means that 2 or more bits in the data unit have changed. The term burst error means that 2 or more bits in the data unit have changed from 1 to 0 or from 0 to 1. Length of Burst Error B is a contiguous sequence of B bits in which the first and last bits and any number of intermediate bits are received in error. Due to impulse noise a burst error occurs DR. GANESHKUMAR N, DEPT. OF CSE 12
  • 13.
    The duration ofnoise is normally longer than the duration of 1 bit, which means that when noise affects data, it affects a set of bits. The number of burst bits affected depends on the data rate and duration of noise. For example,1.if we are sending data at 10 Mbps, a noise of 1micro second can affect 10 bits; if we are sending data at 100 Mbps, the same noise can affect 100bits,i.e., there is an error burst of 100 bits. DR. GANESHKUMAR N, DEPT. OF CSE 13
  • 14.
    Redundancy The central conceptin detecting or correcting errors is redundancy. To be able to detect or correct errors, we need to send some extra bits with our data. These redundant bits (called error detection code) are added by the sender and removed by the receiver. To detect or correct errors, we need to send extra bits i.e., error detection code(redundant bits) with data. DR. GANESHKUMAR N, DEPT. OF CSE 14
  • 15.
    Error Detection Techniques Regardlessof the design of the transmission system, there will be errors during transmission from sender to receiver, resulting in the change of one or more bits in a transmitted frame. Error Detecting Principle: For a given frame of bits, additional bits that constitute an error-detecting code are added by the transmitter. This code is calculated as a function of the transmitted bits. Typically, for a data block of k bits, the error-detecting algorithm yields an error-detecting code of n-k bits, where n-k <k. The error-detecting code, also referred to as the check bits, is appended to the data block to produce a frame of n bits, which is then transmitted. DR. GANESHKUMAR N, DEPT. OF CSE 15
  • 16.
    Error Detection Process DR.GANESHKUMAR N, DEPT. OF CSE 16
  • 17.
    Parity Check  Thesimplest error-detecting scheme (Parity check) is to append a parity bit to the end of a block of data.  Two types of parity checks have been used 1. Odd Parity 2. Even Parity Even Parity The parity bit is set(add or append) by the transmitter such that the total number of ones in the character, has become an even number of 1s means even parity. If the number of 1’s is not even at the receiver side, receiver can detect the error in the transmission. DR. GANESHKUMAR N, DEPT. OF CSE 17
  • 18.
    Odd Parity: The paritybit is set by the transmitter such that the total number of ones in the character, has become an odd number of 1s means odd parity. If the number of 1’s is not odd at the receiver side, receiver can detect the error in the transmission. Eg: Input before transmission- (1110001),  Using even parity -11100010 [0 is appened]  Using odd parity -11100011 [1 is appened] DR. GANESHKUMAR N, DEPT. OF CSE 18
  • 19.
    Cyclic Redundancy Check(CRC) A Cyclic Redundancy Check (CRC) is an error-detecting code. Blocks of data entering these systems get a short check value attached (Frame Check Sequence), based on the remainder of a polynomial of their contents. Given a k-bit block of bits, or message, the transmitter generates an n-k bit sequence, known as a frame check sequence (FCS), [such that the resulting frame, consisting of n bits, is exactly divisible by some predetermined number.(P = n-k+1) The receiver then divides the incoming frame by that predetermined number and, if there is no remainder, assumes there was no error. To clarify this, we present the procedure in three equivalent ways: modulo 2 arithmetic, polynomials, and digital logic. DR. GANESHKUMAR N, DEPT. OF CSE 19
  • 20.
    Modulo 2 Arithmetic: Modulo2 arithmetic uses binary addition with no carries, which is just the exclusive-OR (XOR) operation. Binary subtraction with no carries is also interpreted as the XOR operation: For example, DR. GANESHKUMAR N, DEPT. OF CSE 20
  • 21.
  • 22.
    Polynomials  A secondway of viewing the CRC process is to express all values as polynomials in a dummy variable X, with binary coefficients.  The coefficients correspond to the bits in the binary number. Thus, for D = 110011, we have D(X) = X5 + X4 + X + 1, and for P = 11001, we have P(X) = X4 + X3 + 1.  The CRC process can now be described as T(X) = Xn-k D(X) + R(X) Example CRC implemented in polynomial DR. GANESHKUMAR N, DEPT. OF CSE 22
  • 23.
    Here k=10 (numberof bits in D(X)), P= n-k+1=6 (Pattern p=n-k+1) so n-10+1=6 For D=1010001101, we have D(X)=X9+X7+X3+X2+1. And for P=110101 we have P(X)=X5+X4+X2+1. n=6+10-1=15, FCS(n-k=15-10=5) The message D is multiplied with Xn-k. So D(X) multiplied with X5. [ X5 *D(X) =X5*(X9+X7+X3+X2+1) = X14+X12 +X8 +X7+ X5 The product is divided by P.[P(X)=X5+X4+X2+1]. After the polynomial division, it end up with remainder R= 01110 which corresponds to X3+X2+X1 The message is transmitted as n= X14+X12 +X8 +X7+ X5 + X3+X2+X1 Again the transmitted message is divided by pattern P(X) at the receiver’s side, if it is no remainder then it is called as error free transmission. DR. GANESHKUMAR N, DEPT. OF CSE 23
  • 24.
    Figure 6.4 Exampleof Polynomial Division DR. GANESHKUMAR N, DEPT. OF CSE 24
  • 25.
    Digital Logic Implementation TheCRC process can be implemented by, a circuit consisting of XOR gates and a shift register. The shift register is a string of 1-bit storage devices. The entire register is clocked simultaneously, causing a 1-bit shift along the entire register. The circuit is implemented as follows:  The number of shift registers, equal to the length of the FCS (n-k bits).  There are up to n-k XOR gates.  The presence or absence of a gate corresponds to the presence or absence of a term in the divisor polynomial, P(X), excluding the terms 1 and Xn-k.  Again the transmitted message is divided by pattern P(X) at the receiver’s side, if it is no remainder then it is called as error free transmission. DR. GANESHKUMAR N, DEPT. OF CSE 25
  • 26.
    Digital Logic Implementation Withthe input 1010001101 Circuit with Shift Registers for dividing by the polynomial X5 + X4 + X2+ 1 XZ DR. GANESHKUMAR N, DEPT. OF CSE 26
  • 27.
    C4 C3 C2C1 C0 C4 ⊕ C3 ⊕ I C4 ⊕ C1 ⊕ I C4 ⊕ I I Initial 0 0 0 0 0 1 1 1 1 Step 1 1 0 1 0 1 1 1 1 0 Step 2 1 1 1 1 1 1 1 0 1 Step 3 1 1 1 1 0 0 0 1 0 Step 4 0 1 0 0 1 1 0 0 0 Step 5 1 0 0 1 0 1 0 1 0 Step 6 1 0 0 0 1 0 0 0 1 Step 7 0 0 0 1 0 1 0 1 1 Step 8 1 0 0 0 1 1 1 1 0 Step 9 1 0 1 1 1 0 1 0 1 Step 10 0 1 1 1 0 Example with input of 1010001101 DR. GANESHKUMAR N, DEPT. OF CSE 27
  • 28.
    Error Correction There aretwo approaches Backward Error correction: When an error is detected in a frame, the sender is asked to retransmit the data/frame. This is known as Automatic Repeat request (ARQ).  Eg: Stop-and-wait ARQ, Go-back N ARQ, Selective Repeat ARQ Forward Error Correction: Use more redundancy in the transmitted data to not only detect but to correct error in the received data.  Eg: Hamming code. DR. GANESHKUMAR N, DEPT. OF CSE 28
  • 29.
    Error correction process ErrorCorrection Process DR. GANESHKUMAR N, DEPT. OF CSE 29
  • 30.
    Hamming Distance The Hammingdistance between two words is the number of differences between corresponding bits. The Hamming distance d(v1, v2) between two n-bit binary sequences v1 and v2 is the number of bits in which v1 and v1 disagree. For example, if v1 = 011011, v2 = 110001 then d(v1, v2) = 3 Now let us consider the block code technique for error correction. Suppose we wish to transmit blocks of data of length k bits. Instead of transmitting each block as k bits, we map each k-bit sequence into a unique n-bit codeword. DR. GANESHKUMAR N, DEPT. OF CSE 30
  • 31.
    Example: For n=2, k=5the following assignment is made Suppose that a codeword block is received with the bit pattern 00100.This is not a valid codeword, and so the receiver has detected an error. DR. GANESHKUMAR N, DEPT. OF CSE 31
  • 32.
    Disadvantage: It is nottrue that for every invalid codeword there is one and only one valid codeword at a minimum distance. There are 25=32 possible codewords of which 4 are valid, leaving 28 invalid codewords. Redundancy of the code: With an (n, k) block code, there are valid codewords out of a total of 2n possible codewords. The ratio of redundant bits to data bits, (n-k)/k is called the redundancy of the code, and the ratio of data bits to total bits, k/n, is called the code rate. The code rate is a measure of how much additional bandwidth is required to carry data at the same data rate as without the code. DR. GANESHKUMAR N, DEPT. OF CSE 32
  • 33.
    HAMMING CODE Hamming codecan be applied to data units of any length and uses the relationship between the data bits and redundant bits. To calculate the numbers of redundant bits (k) required to correct d data bits, the condition is 2k >= m + k + 1 where m is data bit. Basic Approach: To each group of m information bits k parity bits are added to form (m+k) bit code. Location of each of the (m+k) digits is assigned a decimal value. The k parity bits are placed in positions 1, 2, …, 2k-1 positions(powers of 2 ). k parity checks are performed on selected digits of each codeword. At the receiving end the parity bits are recalculated. The decimal value of the k parity bits provides the bit-position in error, if any. Figure shows how hamming code is used for correction for 4-bit numbers (d4d3d2d1) with the help of three redundant bits (r3r2r1) for the data bits 1010. DR. GANESHKUMAR N, DEPT. OF CSE 33
  • 34.
    DR. GANESHKUMAR N,DEPT. OF CSE 34
  • 35.
  • 36.
    DATA LINK CONTROLPROTOCOLS First, Data link control, deals with the design and procedures for communication between two adjacent nodes: node-to-node communication. The second function of the data link layer is media access control, or how to share the link. DR. GANESHKUMAR N, DEPT. OF CSE 36
  • 37.
    Need for datalink control 1.Frame synchronization (Beginning and End of frame) 2.Flow control ( sender shouldn’t send faster than receiver capacity) 3.Error control (EC+ED) 4.Addressing (Identity of S and R) 5.Control and data on same link( No physically separation link for control and data info) 6.Link management (coordination and cooperation) DR. GANESHKUMAR N, DEPT. OF CSE 37
  • 38.
    Flow Control Flow controlis a technique for assuring that a transmitting entity does not overwhelm a receiving entity with data. The receiving entity typically allocates a data buffer of some maximum length for a transfer. When data are received, the receiver must do a certain amount of processing before passing the data to the higher-level software. In the absence of flow control, the receiver’s buffer may fill up and overflow while it is processing old data. DR. GANESHKUMAR N, DEPT. OF CSE 38
  • 39.
    Model of frametransmission DR. GANESHKUMAR N, DEPT. OF CSE 39
  • 40.
    Flow Control The timeit takes for a station to emit all of the bits of a frame onto the medium is the transmission time; this is proportional to the length of the frame. The propagation time is the time it takes for a bit to traverse the link between source and destination. DR. GANESHKUMAR N, DEPT. OF CSE 40
  • 41.
    Stop-and-Wait Flow Control Thesimplest form of flow control, known as stop-and-wait flow control, works as follows: A source entity transmits a frame. After the destination entity receives the frame, it indicates its willingness to accept another frame by sending back an acknowledgment to the frame just received. The source must wait until it receives the acknowledgment before sending the next frame. The destination can thus stop the flow of data simply by withholding acknowledgment. It is often the case that a source will break up a large block of data into smaller blocks and transmit the data in many frames. DR. GANESHKUMAR N, DEPT. OF CSE 41
  • 42.
    Contd.. This is donefor the following reasons: • The buffer size of the receiver may be limited. • The longer the transmission, the more likely that there will be an error, necessitating retransmission of the entire frame. • With smaller frames, errors are detected sooner, and a smaller amount of data needs to be retransmitted. • On a shared medium, such as a LAN, it is usually desirable not to permit one station to occupy the medium for an extended period, thus causing long delays at the other sending stations. DR. GANESHKUMAR N, DEPT. OF CSE 42
  • 43.
    DR. GANESHKUMAR N,DEPT. OF CSE 43
  • 44.
    Drawbacks Delayed Acknowledgement/Data: After a timeouton the sender side, a long-delayed acknowledgement might be wrongly considered as acknowledgement of some other recent packet. DR. GANESHKUMAR N, DEPT. OF CSE 44
  • 45.
    The term SlidingWindows refers to imaginary boxes to hold frames. Efficiency of link can be greatly improved by allowing multiple frames to be in transit at the same time. A maintains a list of sequence numbers that it is allowed to send, and B maintains a list of sequence numbers that it is prepared to receive. Each of these lists can be thought of as a window of frames. The operation is referred to as sliding-window flow control. The sequence number to be used occupies a field in the frame; it is limited to a range of values. Sliding-Window Flow Control DR. GANESHKUMAR N, DEPT. OF CSE 45
  • 46.
    Example For a 3-bitfield, the sequence number can range from 0 to 7. Accordingly, frames are numbered modulo 8; that is, after sequence number 7, the next number is 0. For a k-bit field the range of sequence numbers is 0 through 2k-1 and frames are numbered modulo 2k. The maximum window size is 2k-1. It assumes the use of a 3-bit sequence number, so that frames are numbered sequentially from 0 through 7, and then the same numbers are reused for subsequent frames. DR. GANESHKUMAR N, DEPT. OF CSE 46
  • 47.
    DR. GANESHKUMAR N,DEPT. OF CSE 47
  • 48.
    DR. GANESHKUMAR N,DEPT. OF CSE 48
  • 49.
     The exampleassumes a 3-bit sequence number field and a maximum window size of seven frames.  Initially, A and B have windows indicating that A may transmit seven frames, beginning with frame 0 (F0).  After transmitting three frames (F0, F1, F2) without acknowledgment, A has shrunk its window to four frames and maintains a copy of the three transmitted frames.  The window indicates that A may transmit four frames, beginning with frame number 3.  B then transmits an RR (receive ready) 3, which means “I have received all frames up through frame number 2 and am ready to receive frame number 3; in fact, I am prepared to receive seven frames, beginning with frame number 3. DR. GANESHKUMAR N, DEPT. OF CSE 49
  • 50.
     With thisacknowledgment, A is back up to permission to transmit seven frames, still beginning with frame 3; also A may discard the buffered frames that have now been acknowledged.  A proceeds to transmit frames 3, 4, 5, and 6. B returns RR 4, which acknowledges F3, and allows transmission of F4 through the next instance of F2.  By the time this RR reaches A, it has already transmitted F4, F5, and F6, and therefore A may only open its window to permit sending four frames beginning with F7. DR. GANESHKUMAR N, DEPT. OF CSE 50
  • 51.
    Advantages Sliding-window flow controlis potentially much more efficient than stop-and wait flow control. The reason is that, with sliding-window flow control, the transmission link is treated as a pipeline that may be filled with frames in transit. DR. GANESHKUMAR N, DEPT. OF CSE 51
  • 52.
    ERROR CONTROL Error controlrefers to mechanisms to detect and correct errors that occur in the transmission of frames. There is a possibility of two types of errors: 1.Lost frame : A frame fails to arrive at the other side 2.Damaged frame : frame does arrive, but some of the bits are in error (have been altered during transmission). DR. GANESHKUMAR N, DEPT. OF CSE 52
  • 53.
    The most commontechniques for error control are based on some or all of the following ingredients: Error detection: Detecting whether there are corrupted bits in a frame. Positive acknowledgment: The destination returns a positive acknowledgment to successfully received, error-free frames. Retransmission after timeout: The source retransmits a frame that has not been acknowledged after a predetermined amount of time. Negative acknowledgment and retransmission: The destination returns a negative acknowledgment to frames in which an error is detected. The source retransmits such frames. DR. GANESHKUMAR N, DEPT. OF CSE 53
  • 54.
    Contd.. Three versions ofARQ or Three Error control techniques are: 1.Stop-and-wait ARQ 2.Go-back-N ARQ 3.Selective-reject ARQ DR. GANESHKUMAR N, DEPT. OF CSE 54
  • 55.
    Stop-and-Wait ARQ Stop-and-wait ARQis based on the stop-and-wait flow control technique. DR. GANESHKUMAR N, DEPT. OF CSE 55
  • 56.
    Stop-and-wait ARQ isbased on the stop-and-wait flow control technique. The source station transmits a single frame and then must await an acknowledgment (ACK). No other data frames can be sent until the destination station’s reply arrives at the source station. Two sorts of errors could occur. First (damaged frame), the frame that arrives at the destination could be damaged. The receiver detects this by using the error-detection technique referred to earlier and simply discard the frame DR. GANESHKUMAR N, DEPT. OF CSE 56
  • 57.
    Station A sendsa frame. The frame is received correctly by station B, which responds with an acknowledgment (ACK). The ACK is damaged in transit and is not recognizable by A, which will therefore time out and resend the same frame. This duplicate frame arrives and is accepted by B. B has therefore accepted two copies of the same frame as if they were separate. DR. GANESHKUMAR N, DEPT. OF CSE 57
  • 58.
    To avoid thisproblem, frames are alternately labeled with 0 or 1, and ◦ positive acknowledgments are of the form ACK0 (acknowledges receipt of a frame numbered 1 and indicates that the receiver is ready for a frame numbered 0) and ◦ ACK1 (acknowledges receipt of a frame numbered 0 and indicates that the receiver is ready for a frame numbered 1). DR. GANESHKUMAR N, DEPT. OF CSE 58
  • 59.
    Advantage: Simplicity Disadvantage: Only oneframe is sent at a time. No Pipelining. Efficiency is less. DR. GANESHKUMAR N, DEPT. OF CSE 59
  • 60.
    DR. GANESHKUMAR N,DEPT. OF CSE 60
  • 61.
    DR. GANESHKUMAR N,DEPT. OF CSE 61
  • 62.
    DR. GANESHKUMAR N,DEPT. OF CSE 62
  • 63.
    DR. GANESHKUMAR N,DEPT. OF CSE 63
  • 64.
  • 65.
    Selective Reject ARQ DR.GANESHKUMAR N, DEPT. OF CSE 65
  • 66.
    DR. GANESHKUMAR N,DEPT. OF CSE 66
  • 67.
    DR. GANESHKUMAR N,DEPT. OF CSE 67
  • 68.
    DR. GANESHKUMAR N,DEPT. OF CSE 68
  • 69.
    HDLC (High-level DataLink Control) The most important data link control protocol is HDLC. HDLC is a bit-oriented protocol for communication over point-to-point and multipoint links. Basic Characteristics : •HDLC defines three types of stations •Two link configurations •Three data transfer modes of operation. DR. GANESHKUMAR N, DEPT. OF CSE 69
  • 70.
    The three stationtypes are : 1.Primary station : Controls operation of the link, Frames issued called commands 2.Secondary station :Operates under the control of the primary station, , Frames issued called responses. 3.Combined station : Combines the features of primary and secondary The two link configurations are : 1.Unbalanced configuration : Consists of one primary and one or more secondary stations and supports both full-duplex and half-duplex transmission. 2.Balanced configuration : Consists of two combined stations and supports both full- duplex and half-duplex transmission. DR. GANESHKUMAR N, DEPT. OF CSE 70
  • 71.
    Normal response mode(NRM) Used with an unbalanced configuration. The primary may initiate data transfer to a secondary, but a secondary may only transmit data in response to a command from the primary. NRM is used on multi-drop lines, in which a number of terminals are connected to a host computer. DR. GANESHKUMAR N, DEPT. OF CSE 71
  • 72.
    Asynchronous balanced mode(ABM) Used with a balanced configuration. Either combined station may initiate transmission without receiving permission from the other combined station. ABM is the most widely used of the three modes; it makes more efficient use of a full-duplex point-to-point link because there is no polling overhead. DR. GANESHKUMAR N, DEPT. OF CSE 72
  • 73.
    Asynchronous response mode(ARM) Used with an unbalanced configuration. The secondary may initiate transmission without explicit permission of the primary. The primary still retains responsibility for the line, including initialization, error recovery, and logical disconnection. DR. GANESHKUMAR N, DEPT. OF CSE 73
  • 74.
    Frame Structure HDLC usessynchronous transmission. The flag, address, and control fields that precede the information field are known as a header. The FCS and flag fields following the data field are referred to as a trailer. DR. GANESHKUMAR N, DEPT. OF CSE 74
  • 75.
    Flag field The flagfield of an HDLC frame is an 8-bit sequence with the bit pattern 01111110 that identifies both the beginning and the end of a frame and serves as a synchronization pattern for the receiver. There is no assurance that the pattern 01111110 will not appear somewhere inside the frame, thus destroying synchronization. To avoid this problem, a procedure known as bit stuffing is used.  For all bits between the starting and ending flags, the transmitter inserts an extra 0 bit after each occurrence of five 1s in the frame. With the use of bit stuffing, arbitrary bit patterns can be inserted into the data field of the frame. This property is known as data transparency. DR. GANESHKUMAR N, DEPT. OF CSE 75
  • 76.
    DR. GANESHKUMAR N,DEPT. OF CSE 76
  • 77.
    DR. GANESHKUMAR N,DEPT. OF CSE 77
  • 78.
    Contd.. When a patternof five 1s appears, the sixth bit is examined. If this bit is 0, it is deleted. If the sixth bit is a 1 and the seventh bit is a 0, the combination is accepted as a flag. If the sixth and seventh bits are both 1, the sender is indicating an abort condition. DR. GANESHKUMAR N, DEPT. OF CSE 78
  • 79.
    Address field The secondfield of an HDLC frame contains the address of the secondary station. If a primary station created the frame, it contains a to address. If a secondary creates the frame, it contains a from address. An address field can be 1 byte or several bytes long, depending on the needs of the network. If the address field is only 1 byte, the last bit is always a 1.  If the address is more than 1 byte, all bytes but the last one will end with 0; only the last will end with 1. Ending each intermediate byte with 0 indicates to the receiver that there are more address bytes to come. DR. GANESHKUMAR N, DEPT. OF CSE 79
  • 80.
    Control field The controlfield is a 1- or 2-byte segment of the frame used for flow and error control. HDLC defines three types of frames, each with a different control field format. 1. Information frames (I-frames) 2. Supervisory frames (S-frames) 3. Unnumbered frames (U-frames) DR. GANESHKUMAR N, DEPT. OF CSE 80
  • 81.
    Contd.. Information field: The informationfield contains the user's data from the network layer or management information. Its length can vary from one network to another. FCS field: The frame check sequence (FCS) is the HDLC error detection field. It can contain either a 2- or 4-byte ITU-T CRC. DR. GANESHKUMAR N, DEPT. OF CSE 81
  • 82.
    Contd.. Control Field The controlfield determines the type of frame and defines its functionality as shown in below Fig DR. GANESHKUMAR N, DEPT. OF CSE 82
  • 83.
    Control Field forI-Frames I-frames are designed to carry user data from the network layer. 1)The first bit defines the type. If the first bit of the control field is 0, this means the frame is an I-frame. 2)The next 3 bits, called N(S), define the sequence number of the frame. With 3 bits, sequence number between 0 and 7 can be defined. 3)The last 3 bits, called N(R), correspond to the acknowledgment number when piggybacking is used. 4)The single bit between N(S) and N(R) is called the PIF bit. The PIF field is a single bit with a dual purpose. It has meaning only when it is set (bit = 1) and can mean poll or final. DR. GANESHKUMAR N, DEPT. OF CSE 83
  • 84.
    Control Field forS-Frames Supervisory frames are used for flow and error control whenever piggybacking is either impossible or inappropriate (e.g., when the station either has no data of its own to send or needs to send a command or response other than an acknowledgment). S-frames do not have information fields. If the first 2 bits of the control field is 10, this means the frame is an S-frame. The last 3 bits, called N(R), corresponds to the acknowledgment number (ACK) or negative acknowledgment number (NAK) depending on the type of S- frame. DR. GANESHKUMAR N, DEPT. OF CSE 84
  • 85.
    Contd.. •The 2 bitscalled code is used to define the type of S-frame itself. With 2 bits, four types of S-frames, as described below: Receive ready (RR) If the value of the code subfield is 00, it is an RR S-frame. Receive not ready (RNR) If the value of the code subfield is 10, Reject (REJ) If the value of the code subfield is 01, Selective reject (SREJ) If the value of the code subfield is 11, it is an SREJ S- frame. DR. GANESHKUMAR N, DEPT. OF CSE 85
  • 86.
    Control Field forU-Frames Unnumbered frames are used to exchange session or link management and control information between connected devices. U-frames contain an information field, but one used for system management information, not user data. U-frame codes are divided into two sections: a 2-bit prefix before the P/F bit and a 3-bit suffix after the P/F bit. DR. GANESHKUMAR N, DEPT. OF CSE 86
  • 87.
    HDLC frames DR. GANESHKUMARN, DEPT. OF CSE 87
  • 88.
    HDLC Operation HDLC operationconsists of the exchange of I-frames, S-frames, and U-frames between two stations. The operation of HDLC involves three phases. First, one side or another initializes the data link so that frames may be exchanged in an orderly fashion. During this phase, the options that are to be used are agreed upon. Second, the two sides exchange user data and the control information to exercise flow and error control. Finally, one of the two sides signals the termination of the operation DR. GANESHKUMAR N, DEPT. OF CSE 88
  • 89.
    Contd.. Initialization Either side mayrequest initialization by issuing one of the six set mode commands. This command serves three purposes: 1. It signals the other side that initialization is requested. 2. It specifies which of the three modes (NRM, ABM, and ARM) is requested. 3. It specifies whether 3- or 7-bit sequence numbers are to be used. If the other side accepts this request, then the HDLC module on that end transmits an unnumbered acknowledged (UA) frame back to the initiating side. DR. GANESHKUMAR N, DEPT. OF CSE 89
  • 90.
    Data Transfer When theinitialization has been requested and accepted, then a logical connection is established. Both sides may begin to send user data in I-frames, starting with sequence number 0. S-frames are also used for flow control and error control. The receive ready (RR) frame acknowledges the last I-frame received by indicating the next I- frame expected. Disconnect HDLC issues a disconnect by sending a disconnect (DISC) frame. The remote entity must accept the disconnect by replying with a Un numbered Ack and informing its layer 3 user that the connection has been terminated. DR. GANESHKUMAR N, DEPT. OF CSE 90
  • 91.
    DR. GANESHKUMAR N,DEPT. OF CSE 91
  • 92.
     The HDLCprotocol entity for one side issues an SABM command to the other side and starts a timer.  The other side, upon receiving the SABM, returns a UA response.  The logical connection is now active, and both sides may begin transmitting frames.  If the timer expire without a response to an SABM, the originator will repeat the SABM, as illustrated.  This would be repeated until a UA or DM is received or until, after a given number of tries.  The same figure shows the disconnect procedure. One side issues a DISC command and the other responds with a UA response. DR. GANESHKUMAR N, DEPT. OF CSE 92
  • 93.
     When anentity sends a number of I-frames in a row with no incoming data, then the receive sequence number is simply repeated (e.g., I,1,1; I,2,1 in the A-to-B direction).  When an entity receives a number of I-frames in a row with no outgoing frames, then the receive sequence number in the next outgoing frame must reflect the cumulative activity (e.g., I,1,3 in the B-to-A direction).  Note that, in addition to I-frames, data exchange may involve supervisory frames. DR. GANESHKUMAR N, DEPT. OF CSE 93