5 Selective Reject Design

Overview of Things for P3

We'll be using the ARQ Protocol#Sliding Window Flow Control via UDP.

Steps for the assignment (for future reference):

By: Brian Mere (12pm lab section)


Part 1: Design Questions

1-1: Packet Flow (setup)

Below I'll make some packet flow diagrams detailing the following scenarios for connection establishment and then filename exchange.

a. No packets lost (so flow from sending filename/response packet and first few data packets)

b. Packet with the filename is lost going from rcopy to server

c. The file name response packet sent by server to rcopy is lost.

d. First two packets sent by the server are lost.

e. After filename exchange and you start to send data, what happens if the entire first window of data is lost?

f. After filename exchange and you start to send data what happens if an entire window of data is lost?

1-2: Packet Flow (use)

What follows is packet flow diagrams for the use phase of the connection.

a. Normal flow - nothing lost (no errors in data or flow control packets)

b. One data packet lost in a window size of 3 (include how its recovered)

c. Multiple packets lost in a window (look at both sequential packets being lost and non-sequential packets being lost)

Sequential:

and non-sequential:

d. RR lost for packet 2

e. Multiple RR's lost (ex: RR2 and RR3)

f. SREJ is lost

g. Entire window of data being lost

h. Entire window of RR's being lost:

## 1-3: Scenarios

Looking at the previous two sections, there are situations where one would have a closed window (other than a small window size), mainly because the sender times out on a SREJ or RR and thus must resend RDP2. This visually occurs in the packet diagrams when there's a big break in the server sending out the data packets (because it has a closed window), which shows up in situations:

1-4: Handling Out-of-Order Frame/Sequence Numbers

To handle the cases of when the server or rcopy get different sequence numbers, we've outlined how the design will handle this.

a. Data frame number is a duplicate of one you have already received.

Scenario: This is impossible. Assume for contradiction that it did happen, that server just sent say dn which rcopy got while it had sequence number n already. Then the last data sent was dn, since at the very least it got packets d(n-1) ... d(n-1-W) where W is the window size (ie: we could've buffered dn until we got an earlier packet we were waiting for), but then the sequence number was some number less than n itself. Thus either:

Answer: since this can't happen, we don't have to worry!

b. Data frame number is greater than the one you expected but is still in your window size.

Scenario: This is the common buffering technique used in the Sliding Window process. Namely, rcopy may get data frames out of order, for example d0 d2 d3 (lost d1) so then we must buffer d2, d3 and thus we got a frame number greater than the current sequence number 1.

Answer: As the scenario implies:

c. Data frame number is the one you are expecting but you have already received frames with higher numbers

Scenario: Very similar to the last process, this can occur in say getting rcopy with d0 d2 d3 like in the last example. You expected d0 but then you got frames with higher numbers too!

Answer: If they go in sequential order, accept them and send the right RR message of the highest number in the ascending sequence. If there's a gap, then you must buffer the remaining di's and SREJ with the sequence number of the missing data packet. Once you get it, then you can continue going up the sequence of data packets.

1-5: Example of Running the Sliding Window Process

We'll walk through some hand-written examples of doing the Sliding Window Process.:

For all of these assume WINDOW_SIZE = 3!

a. Send frame 0, 1, 2 and then receive RR1, RR3, send frame 3 and 4.

Frame Number 0 1 2 3 4 5 6 7 8 9
(initial) L,C U
Send frame 0 L C U
Send frame 1 L C U
Send frame 2 L C,U
Recv RR1 L C U
Recv RR3 L,C U
Send frame 3 L C U
Send frame 4 L C U
b. Send frame 0, 1, receive RR1, send frames 2, 3, receive SREJ 2, resend 2, receive RR4
Frame Number 0 1 2 3 4 5 6 7 8 9
(initial) L,C U
Send frame 0 L C U
Send frame 1 L C U
Receive RR1 L C U
Send frame 2 L C U
Send frame 3 L C,U
Receive SREJ2 L C U
Resend frame 2 L C U
Receive RR4 L,C U
Notice that at the last RR4 that current had to move at least with L (it can't be behind L).

1-6: More Examples of Sliding Window

Assume your program receives data frames 1,2,3,4,5 and then receives frame 7 and 8 and then frames 10, 11 and 12 (some recovered packet(s) is/are needed to make this work).

Draw a packet flow diagram of your solution using a window size of 3. Discuss how your implementation will handle this situation.

How are RR’s and SREJ’s sent? What packets are sent/resent?

Here:

My implementation will handle this situation by sending RDP packets when getting SREJ from rcopy, which sends it once it notices packets out of order (which it also starts to buffer).

The packets that are not normally sent (duplicated) are d6 and d9, precisely only the missing packets (which is desirable).

1-7: Quick Sliding Window Examples

We'll be using the notation (b,c,u) to indicate (bottom, current, upper) for the values of our sliding window.

a. With a window size of 5: sender sends d1-3, sender receives RR2, sends d4-6, receives RR6, sender sends packets d7 d8, receives SREJ7, sender sends d7, d9, d10

Step Current State in (b,c,u) notation
Sends d1-3 (1,4,6)
Receives RR2 (2,4,7)
Sends d4-6 (2,7,7)
Receives RR6 (6,7,11)
Sends d7-8 (6,9,11)
Receives SREJ7 (6,7,11)
Sends d7, d9-10 (6,11,11)
b. With a window size of 5: sender sends data packets 1-5, sender receives nothing and timeouts, sender resends packet 1, sender receives RR 6, sender sends 6, 7, 8, 9
Step (b,c,u)
Sends d1-5 (1,6,6)
Times Out (1,1,6)
Resends d1 (1,2,6)
Receives RR6 (6,6,11)
Sends d6-9 (6,10,11)
c. With a window size of 5: sender sends data packets 1-5, sender receives RR 3, sender receives SREJ 3, sender resends packet 3, sender receives RR 6, sender sends 6, 7, 8, sender receives SREJ 6
Step (b,c,u)
Sends d1-5 (1,6,6)
Receives RR3 (3,6,9)
Receives SREJ3 (3,3,9)
Sends d3 (3,4,9)
Recieves RR6 (6,6,11)
Sends d6-8 (6,9,11)
Receives SREJ6 (6,6,11)

1-8: Tear-down Phase Design

We'll look at packet-flow diagrams describing how to handle the last packet of the file (the tear-down part):

a. Last data packet is lost

b. Whatever packet you are using to tell the data receiver that the file is done, that packet is lost.

c. RR for the last data packet is lost

(see (b))

d. The 2nd and 5th data packet from the end is lost (so the final data packet gets there but the one before that does not... and the one 4 before that does not). Use WINDOW_SIZE=7.