Download as pdf or txt
Download as pdf or txt
You are on page 1of 22

Flow Control and Error Control

1
Flow Control and Error Control
• Flow Control is a set of procedure to restrict the
amount of data that the sender can send before
waiting for acknowledgment.
• Error Correction is both error detection and error
correction. (Simply : Anytime an error is detected
in an exchange, specified frames are
retransmitted. This process called Automatic
Repeat Request (ARQ).

2
Flow and Error Control Mechanisms

• Stop-and-Wait ARQ
• Go-Back-N-ARQ
• Selective-Repeat ARQ

3
Stop-and-Wait ARQ
• This is the simplest flow and error control mechanism. It has
the following mechanism :
– The sending device keep the copy of the last frame transmitted
until it receives an acknowledgment for that frame.
– For identification purpose, both Data Frame and
Acknowledgment (ACK) frame are numbered alternately 0 and
1. This numbering allow for identification of data frame in case of
duplicate transmission.
A data 0 frame ACK 1
A data 1 frame ACK 0
- A damaged and lost frame is treated in the same manner by the
receiver. (Its simply discards).
- The sender has control variable S, The receiver has control
variable R.
- The sender start a timer when it send a frame.
- The receiver send only positive acknowledgment for frame
received safe and sound.
4
There are four situation in a frame transmission : Normal situation,
the frame is lost, the acknowledgment is lost, or the
acknowledgment is delayed.

Normal situation

5
Lost or Damaged Frame

6
Lost ACK Frame

The receiver
discards the 2nd
copy of Frame 1
7
the acknowledgment is delayed

Numbered ACKs are needed of an acknowledgment is delayed


and the frame is lost. 8
If station A and B both have data to send. Piggybacking is a
method to combine a data frame and an acknowledgment.

9
Go-Back N ARQ
• Go-Back-N ARQ improves the efficiency of Stop and
Wait ARQ in term of using transmission medium.
• It lets more than one frame be outstanding; It can send
up to W frames before worrying about acknowledgment.
• Frame from a sending station are numbered sequentially
with a range from 0 to 2m-1.
• The window slides to includes new unsent frames when
the correct acknowledgments are received (Sliding
Window).

10
Example : Sender Sliding Window

Receiver Sliding
Window

The receiver is always


looking for the specific frame
11
to arrive in a specific order.
Control Variables

S = Variable holds the sequence number of the recently


sent frame.
SF= Holds the sequence number of the first frame.
SL= Holds the sequence number of the last frame.

The size of the window : The receiver only has one


variable “R” that only hold
W = SL – SF+1 the sequence of the frame it
expect to receive 12
• Acknowledgment
– The receiver send positive ACK if a frame has arrived and
sound and in order.
– If frame is damaged or is received out of order, the
receiver is silent and will discard all subsequent frames
until receives the one it is expecting.
– The silent of the receiver causes the timer of
unacknowledged frame to expire.
– It causes the sender to go back and resend all frame,
beginning with the one with expired timer.
• For Example, suppose the sender has already sent
frame 6, but the timer for frame 3 expires. This means
that frame 3 has not been acknowledged, so the
sender goes back and send frame 3, 4, 5, 6 again. (Go-
Back-N ARQ).

13
Go-Back-N ARQ Normal Operation

14
Go-Back-N ARQ; Damaged or Lost Frame

15
Damaged or Lost Acknowledgment …..?
Delayed Acknowledgment …?

16
Sender Window Size

In Go-Back-N ARQ, the size of the sender must be lest


than 2m; the size of the receiver window is always 1
17
Selective Repeat ARQ

• The Go-Back-N protocol is very inefficient


for a noisy link.!!!?
• The Selective Repeat ARQ only resend
one frame is damaged. (More efficient for
noisy link but more complex process at
the receiver).
• The window size at the sender and the
receiver is the same size:
• W = one half of the value 2m

18
Selective Repeat ARQ, Sender and Receiver windows

RF = Receive First
RL = Receive Last

19
Selective Repeat ARQ; Lost Frame

Selective Repeat
ARQ also defines a
negative
acknowledgment
(NAK) that reports
the sequence
number of a
damaged frame
before the timer
expires

20
Selective Repeat ARQ; Lost and
Delayed ACKs and
NAKs……….???

21
Selective Repeat ARQ, Sender and Window Size

22

You might also like