Lecture-6 (TCN TC-316)
(Data Link Layer Protocols)
By
Dr. Rizwan Aslam Butt
Assistant Professor
Department of Electronic Engineering
NED University of Engineering and
Technology
TCN TC-316 NED University of Engineering and Technology
Figure 11.18 Send window for Selective Repeat ARQ
11.2
Figure 11.19 Receive window for Selective Repeat ARQ
11.3
Figure 11.21 Selective Repeat ARQ, window size
11.4
Figure 11.20 Design of Selective Repeat ARQ
11.5
In Selective Repeat ARQ, the size of the
sender and receiver window
must be at most one-half of 2m.
11.6
Algorithm 11.9 Sender-site Selective Repeat algorithm
(continued)
11.7
Algorithm 11.9 Sender-site Selective Repeat algorithm (continued)
11.8 (continued)
Algorithm 11.9 Sender-site Selective Repeat algorithm (continued)
11.9
Algorithm 11.10 Receiver-site Selective Repeat algorithm
11.10
Algorithm 11.10 Receiver-site Selective Repeat algorithm
11.11
Figure 11.22 Delivery of data in Selective Repeat ARQ
11.12
Example 11.8
This example is similar to Example 11.3 in which frame 1
is lost. We show how Selective Repeat behaves in this
case. Figure 11.23 shows the situation. One main
difference is the number of timers. Here, each frame sent
or resent needs a timer, which means that the timers need
to be numbered (0, 1, 2, and 3). The timer for frame 0
starts at the first request, but stops when the ACK for this
frame arrives. The timer for frame 1 starts at the second
request, restarts when a NAK arrives, and finally stops
when the last ACK arrives. The other two timers start
when the corresponding frames are sent and stop at the
last arrival event.
11.13
Example 11.8 (continued)
At the receiver site we need to distinguish between the
acceptance of a frame and its delivery to the network
layer. At the second arrival, frame 2 arrives and is stored
and marked, but it cannot be delivered because frame 1 is
missing. At the next arrival, frame 3 arrives and is
marked and stored, but still none of the frames can be
delivered. Only at the last arrival, when finally a copy of
frame 1 arrives, can frames 1, 2, and 3 be delivered to the
network layer. There are two conditions for the delivery of
frames to the network layer: First, a set of consecutive
frames must have arrived. Second, the set starts from the
beginning of the window.
11.14
Example 11.8 (continued)
Another important point is that a NAK is sent after the
second arrival, but not after the third, although both
situations look the same. The reason is that the protocol
does not want to crowd the network with unnecessary
NAKs and unnecessary resent frames. The second NAK
would still be NAK1 to inform the sender to resend frame
1 again; this has already been done. The first NAK sent is
remembered (using the nakSent variable) and is not sent
again until the frame slides. A NAK is sent once for each
window position and defines the first slot in the window.
11.15
Example 11.8 (continued)
The next point is about the ACKs. Notice that only two
ACKs are sent here. The first one acknowledges only the
first frame; the second one acknowledges three frames. In
Selective Repeat, ACKs are sent when data are delivered to
the network layer. If the data belonging to n frames are
delivered in one shot, only one ACK is sent for all of them.
11.16
Figure 11.23 Flow diagram for Example 11.8
11.17
Data Link Protocols
Asynchronous Synchronous
Protocols Protocols
• Xmodem
• Ymodem
• Zmodem
• BLAST
• Kermit
Character-oriented Bit-oriented
Asynchronous: treat each character in a bit stream independently
Synchronous: take whole bit stream and chop it into characters of equal size
The Use of the Word Asynchronous
Asynchronous Transmission
Generally refers to the transmission of
characters with each character carrying
information about timing
Asynchronous Communication
Refers to overall communication between two
points
An example in this case would be ATM
Asynchronous Transmission
Applied to Characters
Stop Bit Start Bit
Character Frame
Each character is individually timed.
Asynchronous Transmission
Applied to Packets
Burst of Data
Packets of data Packets of data
A
B
Intermittent transmission of packets of data
Asynchronous Transmission/Communication
Application
Character by character transmission
Data packet transmission at present
Asynchronous Protocols
Long, long…time ago
Not complex and easy to implement
Slow
Required start/stop bit and space
Now mainly used in modem
Replaced by high speed synchronous
XMODEM FRAME
Byte 1 Byte 2 Byte 3 Bytes 4-131 Bytes 132-133
Start of Header Packet Number (Packet Number) Packet Data 16-bit CRC
The following defines are used for protocol flow control.
Symbol Description Value
SOH Start of Header 0x01
EOT End of Transmission 0x04
ACK Acknowledge 0x06
NAK Not Acknowledge 0x15
End of Transmission Block (Return
ETB 0x17
to Amulet OS mode)
Cancel (Force receiver to start
CAN 0x18
sending C's)
C ASCII “C” 0x43
Contd..
Uses Simple Stop and Wait ARQ Mechanism
Synchronization
The receiver starts by sending an ASCII “C” (0x43)
character to the sender indicating it wishes to use
the CRC method of block validating.
After sending the initial “C” the receiver waits for
either a 3 second time out or until a buffer full flag
is set.
If the receiver is timed out then another “C” is sent
to the sender and the 3 second time out starts
again.
This process continues until the receiver receives a
complete 133-byte packet.
This protocol NAKs the following conditions:
1. Framing error on any byte 2.
2. Overrun error on any byte
3. Duplicate packet
4. CRC error
5. Receiver timed out (didn't receive packet within 1 second)
On any NAK, the sender will re-transmit the last
packet. Items 1 and 2 should be considered serious
hardware failures. Verify that sender and receiver
are using the same baud rate, start bits and stop
bits. Item 3 is usually the sender getting an ACK
garbled and re-transmitting the packet. Item 4 is
found in noisy environments. And the last issue
should be self-correcting after the receiver NAKs the
sender.
Contd..
Ymodem :
data unit changes to 1024 bytes (Xmodem=128)
use CRC16
multiple files accepted
Zmodem : combination of X and Ymodem
BLAST (Blocked Asynchronous Transmission):
Better than Xmodem (full-duplex, sliding window flow
control)
Kermit (Columbia U) :
Most widely used asyn. Protocol (operation same as
Xmodem)
Synchronous Protocols
Character-oriented protocol
Based on one byte (8-bit)
Use ASCII for control character
Not efficient seldom used
Bit-oriented protocol
Based on individual bits
One or multiple bits for control
More efficient
Binary Synchronous Communication
(BISYNC)OR (BSC)
Character-oriented protocol
Half-duplex, stop-and-wait ARQ
2 frame types
Data frame
(data transmission)
Control frame
(connect/disconnect and flow/error control)
A simple BSC data frame
SYN : Alert the receiver for the incoming frame
BCC : can be LRC (longitudinal redundancy check) or CRC
(cyclic redundancy check)
This simple frame is seldom used
SYN = Synchronous idle = 0010110
STX = Start of text = 0000010
ETX = End of text = 0000011
A BSC frame with a header
Header Fields:
• address (sender/receiver)
• #frame identifier (0/1 for stop-and-wait ARQ)
A multiblock frame
ITB = Intermediate text block
Contd..
Probability of error: Frame size increases, error increases multiple faults
occurs
Difficult to detect errors (error cancel each others)
Message is divided in several blocks
Each block has STX, ITB and BCC
Ending with ETX (end of text)
Error detected, whole frame is discarded (needs retransmission)
ACK for entire frame
one frame is entire message
Control frame
Note: Control Frame is used to send command
* Establish connection
* Maintaining flow & error control
* terminating connection
Control frames
Control frames
Control frames
Data Transparency
BSC is designed for text message
Now, non-text message (graphics,…)
Problem?
BSC control character problem
Data transparency: should be able to
send any data
Byte stuffing
DLE = data link escape
Contd..
Byte Stuffing 2 activities:
- Defining the transparent text region with DLE
- Preceding any DLE character within the transparent region (extra DLE)
Problem still exist if text = DLE ?
Insert an addition DLE next to the character (DLE DLE)
Bit-oriented protocol
Represent more information into shorter
frame
Avoid the transparency problems
Bit-oriented
Protocols
SDLC HDLC LAPs LANs
SDLC: Synchronous data link control – IBM
HDLC: High-level data link control – ISO
LAPs : Link access procedure