Programming Assignment #2
ARQ Programming
Assigned: March 27
Due: April 12 , 11:55PM
Specifications
For this homework you will implement a reliable file transfer
protocol over UDP. You are responsible for achieving reliability
over an unreliable service. The main objective of the assignment
is to design and implement the Selective-Repeat ARQ protocol.
You are to design and implement a reliable
file-transfer application called PFT (Personal File Transfer).
The PFT client can upload a file from its home directory
to the server's home directory.
A PFT server need only handle only one client at
a time, however, it should "run forever".
In other words, the PFT server should be iterative and
not concurrent.
The PFT client, on the other hand, should terminate after
the successful completion of the upload.
The PFT application should implement the
basic functionality of a Selective Repeat transport protocol
using sequence numbers, (positive) selective acknowledgments,
retransmissions and timeouts.
The application will be using UDP/IP sockets for transferring
datagrams. Note that you should not use TCP sockets in this
assignment.
To make things more interesting,
a "packet dropper" will be introducing
random packet losses.
To use the packet dropper, you should use the function
sendto_dropper() (provided by us), instead of the standard
sendto() system call.
The parameters of the sendto_dropper() function are the
same as sendto().
You should initialize the dropper at the start of your program
using the function set_dropper() that is also provided.
For simplicity, these parameters are specified
as integer percentages at the client and server command-line arguments.
Click here for the dropper.h
and for the dropper.c files.
You have significant flexibility in designing the underlying
reliable transport functionality. You should however
adhere to the following specifications:
- The file should be transferred reliably from the
client to the server using a Selective Repeat ARQ protocol.
- The transfer should be reliable in the presence of
packet losses.
- The transport protocol should implement window-based
flow control. The receiver buffer size will be provided
as a command-line argument at the server (in bytes).
The minimum buffer size will be 1KB (1024 bytes) and the maximum
buffer size will be 32KB (32768 bytes).
- The maximum packet size will be a command-line
argument at the client (in bytes). The PFT sender should
be using maximum sized packets when possible.
- Both the server and the client should recognize
an additional flag "-d" (i.e. debug mode) at the command line parameters.
When running in debug mode, the two programs should report detailed
information about their transfer status (e.g., sequence numbers of sent/received
packets, retransmission timeouts, detection of corrupted packets, etc).
Note that there is a global "debug" variable referenced in the sample code.
- The transfer sequence number should start from zero (for simpler
tracing of the protocol's actions).
- Your client should be able to translate hostnames to IP addresses
automatically i.e. it should not matter whether we input a hostname or
an IP address. Use gethostbyname() for the lookups.
The command lines of your client and server should look like:
%pftserver <server_port_number> <buffer_size> <loss_percent>
(e.g., %pftserver 7777 16384 3)
and
%pftclient <server_name> <server_port_number>
<local_filename> <max_packet_size> <loss_percent>
(e.g. %pftclient gaia.cc.gatech.edu 7777 foo.txt 1000 2)
Note that the dropper can have different parameters at the client and server.
The parameters specified at the client determine the error characteristics
in the network path from the client to the server,
while the parameters specified at the server
determine the error characteristics from the server to the client.
Extra-credit: You can earn up to 25% extra credit,
over and above the standard assignment, if you
do a performance analysis of your working application using different
packet sizes and window sizes.
Add a start and stop timer to your sender code to calculate
the total elapsed time from the start of the transfer to
the point where the final successful ACK is received from the server.
Provide a graph showing different transfer times for a
fall using varying window and packet sizes. How does
changing the packet loss rate effect your analysis?
For full credit, provide a brief description of your results.
Notes
-
You should implement two separate programs: a client and a server.
Your final submission should include two executable programs.
To simplify the grading process, please call the executables:
pftserver and pftclient.
-
Your programs are to be written in C or C++.
You should test them on both Solaris/Sparc and Linux CoC systems.
When linking socket programs on Solaris you should
use the "-lsocket -lnsl" options to include the required socket libraries.
-
You can develop your programs at any Unix variant, but you
should make sure that they work on the CoC Solaris and Linux systems for full credit.
For Solaris testing we will use the machine "gaia.cc.gatech.edu" and for
Linux testing we will use "helsinki.cc.gatech.edu". We will test your programs with one end on solaris and the other on Linux.
-
Make sure you terminate the server when you are done working.
See the netstat command for checking on busy network ports.
You may want to use the socket option SO_REUSEADR to make sure that the
port that you use is reusable immediately after your server exits.
-
Make sure that no client or network problems cause
your server to crash. Similarly for the client. Also, check for error conditions
at every system call. Use perror() to report the exact error type.
Write your own signal handlers for the major signals mentioned
at the DC textbook. We will grade your programs mostly based on whether they run
correctly, not only under "normal conditions", but also under
specific failure scenarios (such as the unexpected termination
of a client). At the very least, you should
handle SIGINT signal for terminating your client and server. We WILL
take points off if your server crashes when the client misbehaves or crashes.
-
Provide us with a sample output of your programs.
You can use script or cut-and-paste.
-
Your submissions must contain the string "[CS3251 PFT PRJ2]" in
your subject line. This string *must* appear verbatim *without*
modification in the mail subject i.e. do not make it "[CS3251 homework
3]" or such. Cut and paste this string in your mail subject. If you
wish to add more to the subject (e.g. my good version or my buggy
version), put it after this string.
- Use a cross platform Makefile to compile your programs.
We are including a
sample Makefile here that would link
your programs appropriately on both solaris and linux.
Modify it appropriately to suit your needs.
Submission Instructions
- You should turn in well-documented source code,
a README file, and a sample output file called Sample.txt.
The README file should contain:
- Your name and email address
- Section, date, and assignment title
- Names and descriptions of all files submitted
- Detailed instructions for compiling and running your client
and server programs, including a Makefile.
- A description of your application protocol (1/2 to 1 page)
with sufficient detail for someone else to implement your protocol
independently
- Any known bugs, limitations of your design or program
You will be graded based on the correctness of the code and the
readability and structure.
- You should submit your program by 11:59PM on the due date.
- Use the UNIX "tar" command to create an archive of your
complete set of files, naming your .tar archive file "firstname_lastname.tar":
(e.g. tar cvf george_burdell.tar <directory name>)
-
Email your submission as an attachment to the TAs: frank@gatech.edu for
both Section A and Section B