Let Receiver Window = [ A .. B ]
Receiver receives a data frame;
Let X = send sequence number in received data frame;
if ( A ≤ X ≤ B )
{
Save the received data frame in the receiver buffer;
Send ACK X;
/* --------------------------------------
Try to deliver data frames in sequence
-------------------------------------- */
if ( X == A )
{ /* -----------------------------------------------------
First new frame is received, we can
deliver some data frames
----------------------------------------------------- */
for ( frame i = A; i ≤ B; i++ ) do
{
if ( frame i was received (previously) )
{
Deliver frame i
}
else
{
break;
}
}
Receiver Window = [i .. i+(B-A)+1]
// Advance receiver window !!!
}
}
else
{ /* ==========================================
Frame X has bee received previusly !!!
========================================== */
Discard frame !!!
Send ACK X; // The ACK for frame X may have been lost !!!
// That may be why the sender re-transmits X !!!
}
Example 1:
Suppose:
Sender window =
[1,2,3,4]
Receiver window =
[1,2,3,4]
Events:
The sender transmits
frames1,2,3,4
But: Frame 1 is
lost
Graphically:
Explanation:how the
receiver process the
received frames: