Programming Assignment 2


Overview

For this lab you will implement a Selective Repeat reliable data transfer protocol and test it in a simulator. Your protocol should have a window size of 3. This means that it should have a sequence number space size of 6 (sequence numbers 0, 1, 2, 3, 4, and 5). Your coding will involve writing a subclass of the RDTProtocol class that I will provide. I will provide an example of how subclasses of RDTProtocol are implemented with the AlternatingBitProtocol class. It illustrates the use of several other important classes that will be provided.

NOTE - You can do your work for this assignment on any machine that has a Java compiler with version 1.3 or later. If you are working on a machine with Java 1.5 (for example, the csdev machines) you may see warnings about unchecked or unsafe operations during compilation. You can ignore these warnings.

Set Up

The project files are available as a zipped netbeans project RDT.zip. Click on this link to download it, then unzip it using whatever software your operating system provides.

After downloading and unzipping the project you can run it. The project properties are set so that when you run it, it runs as if you had given the command java RDTTest rdt.AlternatingBitProtocol. You should see the results of running a simulation test with the alternating bit reliable data transfer protocol.

When you have implemented your own protocol class, you can run the RDTTest program with your class name specified in place of "AlternatingBitProtocol". You can modify the project properties so that this is done automatically. The output should be similar in form to the output for the alternating bit protocol, but you should see a more efficient transfer of data.

Documentation for Provided Classes

The classes that you will be working with are extensively documented. The documentation has been compiled into HTML web pages using the javadoc program. You can view this documentation at Programming Assignment 2 Documentation. The RDTProtocol class documentation describes how to implement a subclass. You may also need to use methods in the Packet and RDTTimer classes.

Development and Testing

The implementation in the AlternatingBitProtocol class can be used as an example of an RDTProtocol subclass. The code there is not very clever. It could have been simplified by setting up an array of packets. This would allow most of the if statements in the code to be eliminated.

I recommend that you start with a copy of the AlternatingBitProtocol with the class name changed to something like SelectiveRepeatProtocol. Begin by declaring an array for the packets that it uses and simplifying the code to eliminate many of the if statements. You can then test your modifications with the RDTTest program.

When you have the modifications working, then start implementing changes needed for the selective repeat algorithm. One of the changes you will need is multiple timers. You will need one for each packet in the window.

Program Validation

The execution of your code should be demonstrated in one of the lab sessions on or before March 7. At that time, you should also turn in copies of your RDTProtocol subclass and the modified test class that you use to test it. Also turn in a copy of the output generated during a test.