The reference implementation consists of the following files:
[url removed, login to view] ¨C An application program that uses the go-back-n reliable data transfer protocol to send and receive messages. It sends and receives messages forever in a while loop. In each iteration, it sends two messages to Bob and blocking reads on an incoming message from Bob.
[url removed, login to view] - An application program that uses the go-back-n reliable data transfer protocol to send and receive messages. It sends and receives messages forever in a while loop. In each iteration, it sends one message to Alice and blocking reads twice on incoming messages from Alice.
[url removed, login to view] ¨C implements utility methods that convert byte array to integer and vice versa (same as that in project 1).
[url removed, login to view] ¨C This class simulates the lossy channel that the reliable data transfer protocol operates on.
[url removed, login to view] ¨C The class that defines the structure of the packet, i.e., the transmission unit of the go-back-n transport layer protocol. Encoding and decoding methods are also provided. This class is very similar to the Frame class in project 1. The major difference is that the Packet class now implements the timer management functionality because every data packet may need to be retransmitted and the go-back-n protocol may have multiple outstanding packets. On sending a data packet, a timer is started. If an acknowledgement is received before the timer expires, the timer is cancelled. If the timer expires, the packet is retransmitted, together with all other outstanding packets.
[url removed, login to view] ¨C The class that implements the go-back-n reliable data transfer protocol. Unlike the PAR protocol in project 1, the go-back-n protocol supports duplex communication. Therefore, we do not distinguish sender from receiver. The reference implementation differs from the FSM specification slightly in that every packet is associated with a timer instead of one per window. This deviation is done purely out of convenience and it does not change the nature of the protocol.
These are the tasks to be completed.
Most of the files above are provided with full implementation. But you do need to add the omitted sections in some files and modify the provided code according to the instructions below. Your tasks include:
Thoroughly read and understand the code provided (This task does not apply if you choose to implement this project in a different language)
Complete the main protocol loop in the run() method in TransportLayer class.
Modify the send() method defined in the NetworkLayer class so that you can control the loss rate dynamically. The reference implementation has a hard coded loss rate of 30%, i.e., 3 packets will be lost for every 10 packets sent through the network layer (NOT those through the transport layer!). If you have done this in project 1, you can simply transfer your code here. There are a number of ways you can use to convey the loss rate information dynamically (i.e., at runtime) to the program, e.g., through command line, environment variables and Java Properties. Please consult with the Java Tutorial for detail: [url removed, login to view]
If you code works, run the Alice and Bob programs until Alice finishes sending 1000 messages. Be sure to save the output from both Alice and Bob. Provide line-by-line annotation for the output from Alice and Bob from the beginning of the run through the end of the 2nd iteration. The annotation should be similar to what is provided in the previous section.
Measure the performance of the go-back-n protocol. You need to instrument the Alice and Bob classes to measure the total time required to transmit 1000 messages. Since in each iteration, Alice sends out two messages, and Bob sends out only one message, you need to measure the time it takes for Alice to run through 500 iterations, and that for Bob to run through 1000 iterations. You need to perform the latency measurement under the following configurations: 0 loss, 10% loss, 20%, and 30%. You can take the measurement on the same machine, or on two computers. The measurement result can be reported in a table or in a figure.
Comment out all print statement. This is necessary to find out the true performance of the protocol because the print to standard out takes a lot of time and will artificial inflate the latency value. Use 0 loss rate. Experiment with different retransmission timeout parameters. The default timeout is 1 second defined in TransportLayer class. You need to explore the best timeout value to achieve the best performance of the protocol. Again, you should modify the code to dynamically control the timeout value, similar to what you did in task 3. Once you find the optimal timeout value, use that and measure the total time for Alice and Bob to send 1000 messages, with 0 loss rate.
After you have done the above task, modify the Alice and Bob classes so that in each iteration, Alice sends one message to Bob and waits for the Bob’s reply, and Bob waits for the message from Alice and then sends a reply to Alice. In effect, we are eliminating pipelining completely. Measure the total time for Alice and Bob to send 1000 messages, with 0 loss rate.
Similar to the previous task, modify the Alice and Bob classes so that in each iteration, Alice sends X number of messages before it waits to get a reply from Bob, and Bob receives X number of messages before it sends a reply to Alice. Vary X from 2 to 6 and keep the 0 loss rate. Measure the total time for Alice to send 1000 messages to Bob, for X=2,3,4,5,6. Present your measurement results in both a table and a chart.