4 Stop and Wait Design Process

By: Brian Mere (12pm lab section)


Design

1: Very High Level

Here we'll make a packet flow diagram for the following scenarios:

a. No packets lost:

b. Data packet Lost:

c. ACK Packet Lost:

2: Filename Exchange

We'll draw packet flow diagrams for the following scenarios for the filename exchange or connection establishment exchange:

a. No packets lost:

b. First packet sent by rcopy (filename or establishment packet) is lost

c. First two packets sent by rcopy are lost

d. Second packet sent by rcopy is lost (this might be the ACK for the 1st data packet)

e. First packet sent by the server is lost

f. First two packets sent by the server are lost

g. First data packet sent by the server is lost

3: Review of Concepts

Looking back, it appears that all but the no packets lost (a's of both sections) will trigger the timer, so then poll() will time out in pretty much all of these scenarios.

4: 1:

b. First packet sent by rcopy (filename or establishment packet) is lost

c. First two packets sent by rcopy are lost

d. Second packet sent by rcopy is lost (this might be the ACK for the 1st data packet)

e. First packet sent by the server is lost

f. First two packets sent by the server are lost

g. First data packet sent by the server is lost

3: Review of Concepts

Looking back, it appears that all but the no packets lost (a's of both sections) will trigger the timer, so then poll() will time out in pretty much all of these scenarios.

4: Erroneous Scenarios

Regarding the following possible scenarios for receiving data, I'll explain how this scenario can happen and list what action will be taken with the data and how I'll reply to the sender

a. Data sequence number is the one you expect

How: This can happen during normal operation, sending the right d#'s shown in the packet flow diagrams from previous parts.

What action:

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

How: This can happen when the TIM on the rcopy side is really shortly timed and thus by not getting an ACK fast enough the client sends duplicate data packets.

What action:

c. The data packet is corrupted

How: Bits can be flipped as they are sent over the wire (Fiber Optic Cable or similar)

What action:

d. The ACK is corrupted

How: same as (c)

What action:

5: Packet Flow of Last Packet

Below are packet flow diagrams for handling the last packet of a file:

a. Last data packet is lost

b. ACK from rcopy for last data packet is lost

State Diagrams

Using this, I've made a state diagram for rcopy and another server (two diagrams)