12 - More on Flow Control

Announcements:

We'll be continuing Flow Control from yesterday.

What does Gigabit Ethernet 0/2/0 mean?

  • The first number indicates level in the stack (moving up)
  • The next number is the slot number (by width)
  • The last number is an "out" slot number (ie: some devices have replacable slots, so you'd use this to dilineate. Often this will be just 0)

Lab For Tomorrow

For the lab tomorrow making the Routing Table requires (doing on the Router):

You'll be able to setup your subnet and your gateway of last resort to setup the right network. For example for:

you may have different subnets based on your Network Topologies. That will mean your routing table will have different static routes depending on configuration. For example, the 8 subnet example above would have 3 static routes per router. If you didn't set your gateway of last resort, the router will start dropping your packets and you'll not know why.

Set your (and your labmate's) default gateway

Set your default gateway, probably by ip route 0.0.0.0 0.0.0.0 <next-hop>. The 0.0.0.0's are the destination subnet and mask respectively (used for anything other than default gateway).

If even one default gateway is missing, you will not get a ping from any device (especially very disconnected, far away devices). Even if you do set it up, you may accidentally create a loop that would kill the packet via TTL:

As long as you are being the router and considering how a ping request will get filled out logically, you should be fine.

Address learning (see 2 Ethernet Switches) only happens on the switches, and not the router.

Lastly, you really need to focus on making the diagram, and not just finishing the lab. You'll need it for the following week.

P3 Sliding Windows Protocol

You're going to write a server software rcopy (for the copy) such that we'll use UDP that's a Handshake Protocol (Connection Oriented):

You're going to implement the flow control here, namely the Use step of our Handshake protocol.

This is different than program 2, since while you are still using 3 Sockets Program, recv() and poll(), you have to still fork() and do this poll() in the child instead. You have to essentially forward all of this data to the child.

Note though that this is UDP, not TCP, so you only send and recieve the exact number of bytes you're asking for:


recvfrom(socket num, max length, fromField, fieldLen);
// The `fromField` has info on IP and port #
sendto(socket num, buffer, length, fromField, fieldLen);

Note also that every client only knows about the one child. There may be multiple children, but one rcopy instance only communicates with one child.

Make sure you bind() only in the main program in server (ie: not in the child processes).

The communication between this rcopy and this child is what you are designing for in 4 Stop and Wait Design Process. You can design it by:

Just make sure you read the spec again after reading this (at least 10 times you motherfucker).

Back to Flow Control

Sliding Window Process

Sender's window has some window size (buffer size). We limit the number of un-ACK'ed frames.

There's gonna be 3 variables:

  1. Lower Edge of Window
  2. Upper Edge of Window
  3. Current Frame
Example

Here:

  • Current is the current one to RR with.
Note

Use a struct with a valid flag to clear entries from your buffer, rather than say write all 0's.

Error Handling in Sliding Windows

We'll need to both detect and correct errors. The types of errors we may see is:

  • Bit errors (a 0 was supposed to be a 1 or vice versa, use a Internet Checksum or a CRC)
  • Missing data (the size is lower, a bit was corrupted)
  • Out of order (handle getting getting say RR4 before RR3)

In our sliding window example, we'll look at two error recovery techniques via:

  • Go-back-N ARQ
  • Selective-Repeat ARQ

As a sneak peak, we have Forward Error Correct (FEC) where:

  • We need to detect there was an error
  • This technique adds additional information to the data to fix the error on the receiving side
  • Ex: Hamming Codes, Reed-Solomon Code, Parity
  • May be used at the physical layer in both wireless and fiber connections.
Note

Often the higher layer error correction is more sophisticated, since it'll be seen less often. For lower level (2) error correction fixing just one or two bits is fine.

Determining if there is an Error

How can the receiver detect if there was an error? It can:

Now how can the sender detect the error?

  • Timer (timeout for each data)
  • NACK (negative acknowledgement, to acknowledge errors)
  • If the sending side sees duplicate ACKs (ie: RR3, RR3, RR3) for 3 or more, then try to resend it. Namely, the receiver will be sending these for each new packet successfully received.

Sliding Windows - How to recover from an Error

  1. First, detect an error (previously discussed)
  2. Recover from the error
    1. Go-back-N ARQ
    2. Selective Repeat ARQ

Sliding Windows - How to recover from an Error

  1. First, detect an error (previously discussed)
  2. Recover from the error
    1. Go-back-N ARQ
    2. Selective Repeat ARQ

See also ARQ Protocol for more on Sliding Window.

We essentially are doing RR requests, but now saying what is not there. You cannot RR7 until you RR5 (because it's cumulative), but you could say selective reject (SREJ) 6 and 7 so that you can eventually flush your buffer (ie: you just kill the packets that didn't make it).

On error sender Negative Acknowledges a frame
• Called a Selective Reject (e.g. SREJ 10)
• Sent by data receiver
• Specifies the sequence number of the missing frame