CS 4514
Assignment 3
Prof. D. Finkel
Due: Tuesday, March 4, 10:00 AM. No late assignments will be
accepted.
1. Overview
In this assignment, you will extend the simulated data link you
have developed in previous assignments and implement a sliding
window protocol for acknowledgments and retransmissions.
You will need to use timers in order to implement this program.
We will discuss Unix timers in detail in class on Friday, February
20. A discussion of Unix timers can be found in Chapter 10 of
the Horspool book.
Until you are sure that your program is working correctly,
run all the processes on the same machine.
2. Program details
You may assume that input files in this assignment are a multiple
of 64 bytes, so each frame will contain exactly 64 bytes of data.
As in Assignment 2, you will have two programs, a sender and a
receiver. The receiver will establish a socket and wait (listen)
for a connection request. The sender will connect to the receiver's
socket. The sender will then read from an input file, specified
as a command line argument, and send to the receiver. The receiver
will read the data and write it to a file. Both programs will
record each of the following to a log file:
correct frame sent or received, with sequence number
acknowledgment sent or received, with sequence number
frame with incorrect checksum sent or received, with sequence number
frame violating sliding window policy, with sequence number
The sender will read exactly 64 bytes from the input file, add
a sequence number to the beginning of the frame and a checksum
to the end of the frame. If permitted by the sliding window protocol,
the sender then transmits the frame to the receiver. The sender
window size is specified as a command line argument of the form
-w n where n is an integer. The command line will
indicate a maximum of three frames numbers that are to carry incorrect
checksums the first time they are transmitted, following the command
line switch -e. A maximum of one frame out of order will
also be transmitted: this will be indicated on the command line
by the switch -o, followed by two frame numbers. For example,
if this last option were -o 4 21, the frame 4 would be
transmitted the first time with sequence number 21. Since packet
4 will not be acknowledged, it will need to be re-transmitted;
then, it should be sent with its correct sequence number 4
The command line will also indicate the name of the input file,
the host name for the receiver program and the port number of
the receiver program. The command line for the sender will have
the following form:
sender testfile.in wpi.wpi.edu 2345 -w 4 -e 2 5 8 -o 4 21
The log file for the sender will be named filename.in.log
The receiver program will have an filename, filename.out,
a port number and a window size as command line arguments. The
receiver program establishes a port, and then waits for frames.
As each frame is received, if the frame is not within the receiver's
window, the frame is discarded. If permitted by the sliding window
protocol, the receiver accepts the frame and checks the checksum.
If the checksum is incorrect, the receiver discards the data.
The receiver does not send a NACK. Correct data is written in
order to the output file. The command line for the receiver program
will have the following form:
sender testfile.out 2345 -w 6
Both programs should terminate after the file transfer is complete.
Your assignment may use either the selective repeat or the go-back-n
sliding window protocol.
3. Grading
To receive a C on this assignment, implement the program with
both sender and receiver window fixed at a size of one, and without
handling any out-of-order packets. To receive a B on this assignment,
implement the program with sender and receiver windows of variable
size (as indicated on the command line), but without handling
any out-of-order packets. To receive an A on the assignment, implement
the full program.
For extra credit, experiment with running the program with different
values for the windows sizes, and present an analysis showing
the relationships between window size and performance.
In your readme file, indicate which level you have implemented, and which sliding window protocol you have implemented. If you do the extra credit portion of the assignment, you may hand in your analysis in printed form.