A basic reliable communication protocol (jusk ACK frames)
Review
Recall:
A frame
received with
bit errors is
is discarded
Reason:
Since we do not knowwhich part of the
frame (message) contains
error(s),
it would be foolish to
try to
use some
part of the
frame
So:
the
entire frame (message) is
discarded
Note that:
Both
data frames and
ACK frames
can be
lost
(= received in error)
The basic reliability protocol
Consider the following
basic protocol to
achieve
reliable transmission
(that I called
the basic protocol):
Sender:
Start:
Transmit frame;
Set a timeout;
while ( not timeout && ACK not received )
{
Wait for ACK frame;
}
if ( timeout expired )
{
go to Start;
}
Done; (ACK was received !)
Receiver:
Receive frame;
if ( CRC check is OK )
{
Send ACK frame to sender;
Deliver frame;
}
else
{
Discard frame;
}
Protocol analysis
A communication protocol must
be correct under these
circumstances:
Error-free
With Errors
Types of
errors you need to
consider in
a protocol analysis:
Data frame is
lost (bit error(s))
ACK frame is
lost (bit error(s))
ACK frame is
late
Note:
The duplicate receiption and
out-of-order receiption
errors are
caused by:
Frame loss !!!
Specifically:
Duplicate frame receiption is
caused by
lost of
ACK frame:
click here
Out-of-order frame receiption is
caused by
lost of
data frame:
click here
The basic protocol in
error-free operation
Example:
error-free operation
According to the
basic protocol:
Sender transmits data frame
containing xxx
Sender sets a
timeout for
frame
Receiver receives the
data frame
Receiver transmits a
ACK frame
Receiver delivers the data frame
Sender receives the ACK
frame
before
timeout expires
Done !!!
Error scenario 1: data frame is lost
Scenario 1 :
transmission error in the
data frame
According to the
basic protocol:
The sender transmits
data frame
Sendersets a
timeout for
frame
Data frame is
lost (bit error(s))
Receiver will
not transmit
an ACK frame !!!
The sender will
time out:
Sender will
retransmit
the same frame
The time, the receiver recived it
correctly and
transmits
a ACK frame
Conclusion:
The simple protocol can
recover:
Data frame
transmission errors !!!
Error scenario 2: ACK frame is lost
Scenario 2 :
transmission error in the
acknowledgement frame
According to the
basic protocol:
The sender transmits the
data frame
The receiver
receives the data frame
(correctly)
The receiver
transmits
an ACK frame
The receiver
will deliver the
data frame
The ACK frame
is lost.....
The sender will
time out !!!
Consequently:
The sender will
assume
that the data frame was
lost !!!
The sender will
re-transmit the
same data frame
The receiver receives
a
(duplicate) frame
The receiver will
deliver the
data frame
Error:
A data frame is
delivered
multiple times !!!!
Recall that:
Reliable communication means:
All messages received
exactly once
(And in the same order as
they were transmitted)
Fixing the protocol error
Right now,
we cannotcorrect
the protocol errorbecause:
The receiver
is unable to
distinguish:
A re-transmission (= old) of
a data frameand
A new transmission of
a data frame
Graphically explained:
Case 1:re-transmission of
an old frame
Remember, the
receiver will
only "see"
the following events:
Case 2:
Remember, the
receiver will
only "see"
the following events:
The receiver
do not have
enough information
to
distinguish
these 2 different cases
from
one another !!!
The fix
(add more
information !!!):
The senderadds
a send sequence number
to identify
each data frameuniquely
The receiver will
use the
send sequence number to
check whether a
data frame is: