CS 455/555 - Intro to Networks and Communication
Spring 2011: Tues/Thurs 9:30-10:45am, Spong 108

Print - Admin

Announcements

Staff

Schedule

Final Paper

Syllabus

Links

Program 4: Alternating Bit Reliable Transport

Assigned: Thursday, April 7, 2011
Due: Thursday, April 21, 2011 before midnight

Description

The goal of this assignment is to implement the alternating bit reliable transport protocol that you designed in your last homework assignment. Remember that this is based off of the RDT 3.0 reliable transport protocol from Chapter 3. You will implement both a sender and a receiver.

Sender

  • The sender accepts three command-line arguments: receiver hostname, receiver port, number of unique messages to send
  • The sender sends messages with the following format: SEQNO DATA MSGS
    • SEQNO starts at 0 (since this is an alternating bit protocol, SEQNO can be either 0 or 1)
    • DATA starts at 0 and increases by 1
    • MSGS is the total number of unique messages that will be sent
  • Since this is an alternating bit protocol, the sender cannot send the next message until the previous one has been acknowledged by the receiver.
  • If an ACK is not received before the timer expires, the previous message must be re-sent.
    • Set the timeout to 1 second (1000 ms).
  • The sender program should exit when the ACK for the last message has been received.

Receiver

  • The receiver accepts three required command-line arguments: listening port, average delay, and loss percentage. The receiver also accepts an optional fourth command-line argument: seed.
  • Each time the receiver gets a message from the sender, it will respond with an ACK.
  • Before sending an ACK, the server will delay or drop the packet as in Program 2.
    • The ACK for the last message should not be dropped.
    • To get loss and delay like the examples, make sure that you only create the Random object once, decide if the packet should be dropped first, and only choose delays for packets that will not be dropped.
    • For the last ACK, don't check to see if you need to drop it (you won't) before finding its delay. Otherwise, you'll get different delay numbers than in the examples.
  • The receiver should determine the number of unique messages that will be sent by looking at the first message sent by the sender.
  • The receiver will print the data of each message received from the sender. As done previously, your program will be tested using a script, so make sure that your output matches the examples exactly.
  • The receiver program should exit when it has sent the ACK for the last message.

Rules

  • As with all projects, you are not permitted to work with anyone else (even students not in the class) - all of the coding and documentation must be your own.
  • Your programs must compile and run on the CS Unix machines.
  • You must write neat code and document it well. You will lose points for sloppy programs that contain little or no comments.

Testing

A large part of your program's grade will be determined by how well it handles a set of inputs. You should test your program rigorously before submitting. Because your programs will be run and tested using a script, you must format your output exactly as I have described or you will lose points.

Example 1

antares> java AbrtReceiver
Usage: java AbrtReceiver port delay lossRate [seed]
         port - listening port (10001-11000)
         delay - avg delay (ms)
         lossRate - loss percentage [0-1]
         seed - RNG seed (optional)

vega> java AbrtSender 
Usage: java AbrtSender host port msgs
         host - receiver hostname
         port - receiver port (10001-11000)
         msgs - number of unique messages to send

Example 2

antares> java AbrtReceiver 10005 4 40
ERR - arg 3

Example 3

antares>   java AbrtReceiver 10005 500 0.1 7777
RECV: 0 0 4
SENT: ACK 0 - delayed 425 ms

RECV: 1 1 4
SENT: ACK 1 - not sent

RECV: 1 1 4
SENT: ACK 1 - delayed 577 ms

RECV: 0 2 4
SENT: ACK 0 - delayed 701 ms

RECV: 1 3 4
SENT: ACK 1 - delayed 872 ms

vega>  java AbrtSender antares 10005 4
SENT: 0 0 4
RECV: ACK 0

SENT: 1 1 4 - timeout

SENT: 1 1 4
RECV: ACK 1

SENT: 0 2 4
RECV: ACK 0

SENT: 1 3 4
RECV: ACK 1
Note: The packets dropped and the amount of delays should be exactly as in this example since a seed was specified on the command-line.

Example 4

antares> java AbrtReceiver 10005 150 0.2 7890
RECV: 0 0 4
SENT: ACK 0 - not sent

RECV: 0 0 4
SENT: ACK 0 - not sent

RECV: 0 0 4
SENT: ACK 0 - delayed 197 ms

RECV: 1 1 4
SENT: ACK 1 - delayed 131 ms

RECV: 0 2 4
SENT: ACK 0 - not sent

RECV: 0 2 4
SENT: ACK 0 - delayed 270 ms

RECV: 1 3 4
SENT: ACK 1 - delayed 145 ms

vega> java AbrtSender antares 10005 4
SENT: 0 0 4 - timeout

SENT: 0 0 4 - timeout

SENT: 0 0 4
RECV: ACK 0

SENT: 1 1 4
RECV: ACK 1

SENT: 0 2 4 - timeout

SENT: 0 2 4
RECV: ACK 0

SENT: 1 3 4
RECV: ACK 1

Example 5

I'm not giving the results here, but try this:

java AbrtReceiver 10005 650 0.4 5678

It should produce two premature timeouts in a row (on data 1 and the retransmission of data 1) by delaying the ACKs by 1000ms and 1266ms. Convince yourself that the operation of your program is correct.

Submission

You must name your source files AbrtSender.java and AbrtReceiver.java (note the capitalization). Make sure that you submit all files necessary to compile your program. But, do not submit compiled files (.class files).

Directions for submitting your assignment through Blackboard