Implementing Go-Back-N Protocol
In this assignment, you are asked to implement the sender and the receiver that communicate using the GBN protocol using UDP. The sender and receiver will be connected through an intermediate program called "twister" that may "twist" the packets. The logic of the GBN protocol can be obtained from the textbook or online resources.
The Sender
1. The sender takes the following four command-line arguments:
* the port number the sender uses to send data and receive acks
* the destination's ip and port number (alternatively, we could put twister in the middle, then we use the twister's ip and port number)
* the name of the file to be sent
2. The sender program should do normal sanity check. For example, prompt helpful information if the arguments are not properly provided, or if the file does not exist, etc.
3. The sender program should implement the sender logic of GBN.
* The user can define whatever format for the UDP data packets and UDP ACK packets. However, you should include a sequence number for each UDP data/ack packet, starting from 0 (you don't need to worry about wrap around).
* You should implement checksum, since packets may be corrupted in transit (by twister, especially).
* You should use 10 ms as the retransmission timeout.
* You should use 100 packets as the maximum window size. (We change the max window size from 10 packets to 100 packets on 10/10).
* You should use 1 KB as the maximum packet size (excluding header).
4. The sender should be able to generate and send as many data packets unacknowledged as the maximum window size. You don't need to implement congestion control.
5. Print out the throughput the sender achieves at the end of the program (in bits per second).

The Receiver
1. The receiver takes two command-line arguments:
* the port number it is using to receive data packets and send ack packets, and
* the file name for storing the received data.
2. The receiver should be to find out the sender's (or the twister's) ip and port number, by inspecting the source ip and port number from the packets it receives.
3. The receiver needs to implement the receiver logic of the GBN protocol.
4. There will be one and only one source sender for each receiver run. No parallel transmissions. Upon receiving all packets (the header needs to indicate the sequence number and the total number of packets expected to be transmitted), the receiver can terminate.
5. Proper received data should be stored in the given file. By comparing the file sent and received, you'll know if your logic is correct. By inpectiing the throughput, you'll know if you are truly able to handle muliple packets with respect to the max window size.
The Twister (or the Middleman)
1. First connect your sender and receiver directly to see if they work under perfect conditions.
2. The twister program is provided at svn repository.You can use it to test your sender/receiver programs to handle error conditions, such as corruption, loss, delays, packet reordering, etc.The twister receives packet from the sender and sends it to the receiver; conversely, it receives packet from the receiver and sends it to the sender.
3. The twister starts with the following arguments:
* the port number it is using to receive data/ack from sender/receiver
* the sender's ip address and port number
* the receiver's ip address and port number
* corrupt probability Pc (between 0 and 1)
* drop probabilityPd (between 0 and 1)
* reordering propabilityPo (between 0 and 1)
* the time interval (in milliseconds) that packets enqueued will be sent out
4. With the given probability Pc, it corrupts a to-be-forwarded packet by flipping a bit.
5. With the given probability Pd, it drops a to-be-forwarded packet.
6. For each incoming packet (at each direction), it puts the packet in a queue. At the given interval, it retrieves the packet from the queues (there is one queue for each direction)and forwards it to sender or receiver.Packets are retrieved from the queues normally in first-in-first-out order. But with a given probability Po, the second packet in queue gets out before the first one.
7. The program also print out what's going on so that we know during the run.
For all programming assignments, you must provide sufficiently detailed comments with your code so that someone reviewing your code may understand what you're doing without too much second guess. It'll be your loss if the instructor finds it difficult to understand your code. In the beginning of your program, always put some readme information (in a separate README.txt file). State the author's name, provide a brief description of the function of the program, and list the resources you used (it's an ethical violation if you use code but fail to name the source). Also, describe how to compile, run, and test your program.
Please note thatCHEATING WILL NOT BE TOLERATED in this class. Your work needs to be your own. It cannot be joint work with another student in the class or who previously took the class. THERE WILL BE ZERO TOLERANCE FOR CHEATING. You CANNOT give or receive code to and from your fellow students. You CANNOT pull code from the internet. If you get caught in cheating, you will immediately receive an F for this course and the Academic Misconduct will be reported to the university. NO EXCEPTIONS.
Please follow the directions below carefully when you're about to submit the assignment:
1. You should create a separate directory where you put all your source files. Assuming your name is John Smith, you shall name your directory john-smith-hw2. Of course, you need to replace that with your true name.
2. You must provide a Makefile with at least two targets. The default 'make' will build the executable file and 'make clean' will remove all generated files (including the object files, the executable, and all other temporary files); your submission should be a directory that contains only the source code, the Makefile, and possibly with the test cases.
3. Please provide a README.txt file with detailed instructions how to test your program. If not, the instructor would try to find the instuctionsf from your source code. Or he's going to use common sense. You won't receive grade if he can't manage to compile and test your program.
4. In a separate file named PERFORMANCE.txt, provide a table that shows the throughput achieved when running your sender and receiver through the twister (all on the same machine; please indicate the configuration of your machine that you use to run the experiments), and setting Po=0, Pd=0,and setting Pc=0, 0.01, 0.02, ..., 0.010, respectively. In another table, do the same, but set Pd=0.01, while changing Pc. For each combination, please list the throughputresult of all five runs. (Your instructor will verify the output by running a few samples).
5. You need to archive and compress the directory by running the following command in the parent directory: "tar czvf firstname-lastname-hw2.tar.gz firstname-lastname-hw2".This will create a file named firstname-lastname-hw2.tar.gz, which you should upload to moodle.
Please submit the homework before the deadline as stated. Late submission will incur penalties as described in the syllabus.
Due date:
Monday, 21 October 2013, 11:55 PM

