Go-Back-N Assignment
due: March 27
Useful files:
Description
Your task in this assignment is to write the sender portion
of the Go-Back-N algorithm for reliable data transfer. Your
program will allow the user to type messages that will be
sent and reassembled by a receiver.
The code for the receiver is in the file
Receiver.java. The receiver is
somewhat malicious; it will cause some packets to get thrown
away. It will, however, keep track of all the packets it has
received or sent so you can use this information for debugging
your program. The test area at the bottom of the receiver shows
the packet as they are delivered to the application, so the text
that appears here should be identical to what the sender sent.
The receiver will not cause data corruption so you do not need to
deal with checksums. You should not modify this program's
functionality as it will be used to test you sender.
Your sender will send a single character in a packet along with
an id number through a UDP channel. The data in the packet will therefore
be three bytes long. One byte will be the sequence number of the packet, the
next two will be the two bytes from the character.
ACK packets will contain one byte of data indicating the packet number
that is being acknowledged.
The file SendGBN.java contains an outline
for the sender program. You may use any or none of it. You may find a better
way to do the program, if you chose. The outline on SendGBN.java is a
multithreaded solution. Notice there is a thread that simply waits for
ACK packets and handles them when they come in. Read the comments carefully
in this code, they may help a great deal.
You will have to include the code for the timer and for some data structure
to hold unACKed packets for later retransmission.
Implementation Notes
These are in no particular order.
- Characters are 2 bytes, you will have to find a way to transfer
them into an array of bytes. Use the & operator to mask the appropriate
bits and the >> shift to move them into position.
- Some options for the timer implementation are:
- javax.swing.Timer
- java.util.Timer
- Use your own thread.
The first option is probably the easiest. The Timer in swing
fires ActionEvents like a Button or JButton would when clicked.
See the Java Docs.
- Some options for a container for unACKed packets:
- java.util.Vector
- an array of packets
- java.util.ArrayList
- java.util.LinkedList
- java.util.HashTable
- something else?
Questions
- Illustrate what happens when the maximum sequence number
is different in the sender
than the receiver in the Go-Back-N algorithm.
- What happens if multiple senders send messages to the receiver?
- What is the largest value of N possible for this application?
- Set the probability to 0.5 on the receiver and send it a short
message. Does the number of retransmissions of your packets match
this probability? Why or why not?
- The choice of a data structure for an application is an important
design decision. Explain your choice of data structure
for holding unACKed packets.
Extra Credit
You will receive extra credit for the following:
- Finding a bug no one else has found in Receiver.java (1%)
- Finding a bug no one else has found in Receiver.java and fixing it (3%)
- Finding a bug no one else has found in Receiver.java and fixing it
with enough time that the class can be made aware of the
fix--within 2 days of the due date. (5%)
- Proving that there are no bugs in Receiver.java (priceless)
Submission
You will need to submit the following:
- A working sender program. Submit by email on or before the due date.
- Answers to the questions above. Submit on paper at the
beginning of class.
- Any extra credit. Submit by email on or before the due date.
Last modified: Wed Mar 19 14:57:10 Eastern Standard Time 2003