CS455 Syllabus

### The Receiver Windew Algorithm using cumulative ACKs

• Recall that:

 Receiver buffer = buffer in the receiver to store undeliverable data frames

 Receiver window = the sequence numbers of the data frames that the receiver will store (save) in the receiver buffer

• How the receiver window changes (= "moves") with cumulative ACKs

• Update algorithm for the receiver window:

 ``` Let Receiver Window = [ A .. B ] Receiver receives a data frame; Let X = send sequence number in received data frame; if ( X == A ) { Save the received data frame in the receiver buffer; /* -------------------------------------- Deliver buffered data frames !!! -------------------------------------- */ i = A; while ( data frame i is received ) { Deliver frame i i++; } /* ============================================= Now: i = seq no of first missing data frame ============================================= */ Receiver Window = [i .. i+(B-A)+1] // Advance receiver window !!! Send ACK i; } else if ( A < X ≤ B ) { Save the received data frame in the receiver buffer; Send ACK A; // Frame #A is still missing } else { Discard frame !!! // This must have been an old frame Send ACK A; // Recover possibly lost ACK frames } ```

• Example 1:

• Suppose:

 Sender window = [1,2,3,4] Receiver window = [1,2,3,4]

Events:

 The sender transmits frames 1,2,3,4 But: Frame 1 is lost

 ``` Receiver window = [1 .. 4] Frame 1: lost Frame 2: 2 == 1 ? No 1 < 2 ≤ 4 ? Yes ===> buffer frame 2 Send ACK 1 Frame 3: 3 == 1 ? No 1 < 3 ≤ 4 ? Yes ===> buffer frame 3 Send ACK 1 Frame 4: 4 == 1 ? No 1 < 4 ≤ 4 ? Yes ===> buffer frame 4 Send ACK 1 ```

Graphically:

Note:

 The receiver window does not slide forward !!!         (because no frame has been delivered !!!).

• Example 2: example continues

• Since the receiver did not send ACK for frame #1:

 the sender will time out

Suppose after the time out, the sender retransmits frame 1 and it is received correctly

 Sender window = [1,2,3,4] Receiver window = [1,2,3,4]

Events:

 The sender retransmits frame 1 Frame 1 is received correctly

 ``` Receiver window = [1 .. 4] Frame 1: 1 == 1 ? Yes !! ===> Buffer frame 1 ===> Send ACK 1 i = 1; while ( frame i received ) loop: i = 1: is received ? Yes ===> deliver frame 1 ===> i++ (i=2) i = 2: is received ? Yes ===> deliver frame 2 ===> i++ (i=3) i = 3: is received ? Yes ===> deliver frame 3 ===> i++ (i=4) i = 4: is received ? Yes ===> deliver frame 4 ===> i++ (i=4) Receiver Window = [5 .. 8] Send ACK 5 !!! ```

Graphically:

Result:

• The receiver will deliver frames 1,2,3,4 to the user program

 Now the receiver window will slide to [5,6,7,8]

The receiver will now buffer the data frames 5,6,7,8 !!!

• Note:

• When the sender receives the ACK 5 frame, the sender window will move as follows:

The sender window and receiver window are "lined up" (= starts with the same seq. no.)