| File Transfer using Sliding Window Protocol UDP 1
1. Objective
The objective of this programming project is to learn UDP reliable client-server interaction using UDP
socket interface in C programming language. After completing the project, you will have a basic
understanding of the steps required to add reliability features in UDP applications for developing a
networking application.
2. Project Specification:
2.1. Overall System Behavior:
You are required to implement a reliable simple file transfer protocol which uses the Selective repeat
sliding window protocol for data and flow control. For detail about the Selective repeat sliding window
protocol, please refer to your textbook (Andrew S. Tanenbaum, “Computer Networks”, Prentice Hall,
Fourth edition., Page 211). Selective repeat is the basic mechanisms used in reliable window-based
process to process communication protocol. The Selective repeat window protocol contains a sender
window. There is also a receiver window that allows the receiver to buffer packets received in any order.
The essence of the selective repeat protocols is that at any instant of time, the sender maintains a set of
sequence numbers co
esponding to frames it is permitted to send. These frames are said to fall within
the sending window. Similarly, the receiver also maintains a receiving window co
esponding to the set of
frames it is permitted to accept. The receiver can explicitly request retransmission of a "missing" packet
from the receiver by sending a negative acknowledgement. The following figure shows high-level overall
system requirements.
CS XXXXXXXXXX: Data Networks
Graduate Project
8File Transfer using Sliding Window Protocol UDP 100 pts
User Authentication
Anna Hg58YKI9
Jackson KL88SYRS
Susana N7ByZa3
Samreena OU95Xm
userList.txt
inputFile outputFile
File transfer from sender
to receiver using
Selective-Repeat sliding
window protocol
XXXXXXXXXX
XXXXXXXXXX
………………………
XXXXXXXXXX
XXXXXXXXXX
XXXXXXXXXX
………………………
XXXXXXXXXX
Due Date:
Upload to Canvas
11/27/2022 Fall - 2022
| File Transfer using Sliding Window Protocol UDP 2
2.2. Sender Behavior [Server]:
• At startup, the sender takes two arguments that specify the port number that it is listening to and
the window size. You have to use (5000+last 4 digits of your student-id number) to avoid
equesting same port by multiple students. The second parameter, window size of the sender, is
set to be equal to 1.
• After successful startup, the sender program will wait for a UDP client interaction for user
authentication. Server has userList.txt file which contains username and password separated by
a blank space. If authentication is successful, then sender will wait for a file transfer using UDP.
• After receiving a file name from the client, sender process will verify the existence and read
permission of the file. If the file doesn’t exist or permission denied, then the sender will transmit
appropriate warning message back to client and wait for a new valid file name.
• If the file exists and read permission granted, then sender will send the window size (sender and
eceiver has same window size) and start transmitting data using UDP packet to client. You may
use 128/256 bytes of payload per packet.
• Your sender program should handle this packet transfer using Selective-Repeat Sliding Window
Protocol discussed earlier.
• The protocol identifies the DATA segments by using sequence numbers. The sequence number of
the first segment must be 0. It is incremented by one for each new segment. The receiver must
acknowledge the delivered segments by sending an ACK segment.
• Along with each data packet, you need to deploy a timer to keep track of delayed or lost
ACK/NACK packets from the receiver.
• As the sender program receives ACK from the receiver, it needs to randomly drop 10% of the ACK
to simulate ACK lost from the receiver (generate random numbers to handle this requirement).
You need to retransmit based on the Selective Repeat protocol before sliding the sender’s
window. The flow of data is unidirectional, meaning that the sender only sends DATA segments
and the receiver only sends ACK segments.
• Finally, when the data transmission is complete, your sender program will go back and wait for
another UDP client communication for next user authentication and file transfer.
2.2.1. Sender Output:
• You need to print SEQ number and type of operation (transmission
etransmission) message
after sending the data packet so that we can see your processes are working co
ectly (or
not!).
• After successful transmission
etransmission of packets, when the file transfer is complete,
your sender program should print the following statistical report about the whole
transmission.
o Receiver IP and Port Number
o Name and Size of the file that was transfe
ed
o File Creation Date & Time
| File Transfer using Sliding Window Protocol UDP 3
o Number of Data Packets Transmitted
o Number of Packets Re-transmitted
o Number of Acknowledgement Received
o Number of Negative Acknowledgement Received with Sequence Numbe
2.3. Receiver Behavior [Client]:
• Your client program takes four arguments from user during startup that specifies the IP address
and port number of the sender, input file name that receiver wants to copy from the sender and
the output file name which will be used for creating the new file at receiver side.
• After a successful startup, your receiver program will print a welcome message and ask the user
to input username and password for login into the sender program (server).
• These data will be sent to the receiver program using UDP for the user authentication. Then, your
sender, after receiving the username and password from the receiver, will verify the received pair
of username and password against the pairs in userList.txt file. If the result is positive, the server
will send a success message to the receiver along with the window size (sender and receiver has
same window size). If the result is negative, the server will send an e
or message to the sender
and wait for the new pair.
• After successful authentication, your receiver program will ask the user whether to start the file
transfer or not. With a positive feedback, the input file name will be sent to the sender program
to verify the existence and access permission.
• If file doesn’t exist or permission denied, the sender program will inform the receiver. You need
to print the message and prompt the user for a new valid file name. If the file exists and read
permission granted, then receiver will create an output file and start copying the incoming data
into the file. Note, UDP packets may come unordered. You need to keep track of it using the
sequence number.
• Your receiver program should handle this ACK/NACK packet transfer using Selective-Repeat
Sliding Window Protocol discussed in the class.
• As the receiver program receives data packets from the sender, you need to randomly drop 10%
of the data packets to simulate the data lost (generate random numbers to handle this
equirement). You need to send NACK packet based on the Selective Repeat protocol before
sliding receiver window for new set of packet(s).
• When the file is completely received, your receiver will go back and ask the user whether they
wants to send any more file or not.
2.3.1. Receiver Output:
• You need to print informative message after receiving a data packet and sending an
ACK/NACK packets so that we can see your processes are working co
ectly or not.
• After successful file receive, your receiver program should print the following statistical
eport about the whole transmission.
o Name and Size of the file that was received
| File Transfer using Sliding Window Protocol UDP 4
o File Creation Date & Time
o Number of Data Packets received
o Number of Acknowledgement Sent
o Number of Negative Acknowledgement Sent
2.4. Input Format:
Sender and receiver must be command-line tools that allow transmitting one binary file and
supporting the following parameters:
sender
receiver
3. Programming Notes:
You have to use UDP sockets for implementing both sender and receiver programs. You should
program each process to print an informative statement whenever it takes an action (e.g., sends or
eceives a message, detects termination of input, etc), so that you can see that your processes are
working co
ectly or not. One should be able to determine from this output if your processes are
working co
ectly. You should hand in screen shots (or file content, if your process is writing to a file)
of these informative messages.
Make sure, your Sender (server) allows the user to specify the listening port number and window size
during startup. You have to close every socket that you use in your program. If you abort your
program, the socket may still hang around and the next time you try and bind a new socket to the
port ID you previously used (but never closed), you may get an e
or. Also, please be aware that port
ID's, when bound to sockets, are system-wide values and thus other students may be using the port
number you are trying to use though it’s prohibited. . If you need to kill a process after you have
started it, you can use the LINUX kill command. Use the LINUX ps command to find the process id of
your server.
Any clarifications and revisions to the project will be posted on the course web page on Canvas.
Students are encouraged to start this project early and use the project discussion group on Canvas for
any general question so that everyone can benefit from the replies.
File names:
File names for this project are as follows:
XXXXXXXXXXClient: lastNameSelectiveRepeatReceiver.c
Server: lastNameSelectiveRepeatSender.c
| File Transfer using Sliding Window Protocol UDP 5
4. Points Distribution:
Bits and pieces Points
Client Program 40
Server Program 40
Program Style (Coding style, comments etc.) 10
Documentation 10
5. Submission Instructions:
This project requires the submission of a soft copy. Plagiarism will not be tolerated under any
circumstances. Participating students will