HW4 Simple UDP Client Server File Downloader With Socket Options
HW4 Simple UDP Client Server File Downloader With Socket Options
Details:
Once the client starts, it sends a “hello” message to the server which is running on port
22334. As a result, the server sends out a one byte value equal to 01010101 (0x55) to the client and
waits for an acknowledgement from the client, which should be a one byte value equal to 10101010
(0xAA). The server, after that, prepares a list of files in its current working directory and sends that
list to the client, and waits for a request from the client containing the filename (null-terminated) to
download. The client, on the other hand, displays that list to the user and asks him/her to enter a
filename to download and sends that request to the server. if the file exists on the server, the server
will send a one byte value equal to 1 to the client; else, the server will send a one byte value equal to
0 and wait for other future connections; if file exists (after sending the (char) 1), the server opens the
local file and sends it to the client in chunks of up to1024 bytes at a time. Once finished, it waits for
another request. The client saves the file locally [make sure the client and server run at different
directories if they are on the same machine so that you can use the same filename] or you can ask the
user to enter a different filename for saving. After that, the client asks the user to enter another
filename to download, or enters the string “done” to exits. If the server receives another filename,
the above steps are repeated ( if the file exists on the server …..etc). If the received string is “done” ,
the server also exits.
In order to make sure that you don’t face a buffer limitation problem, your client code should
get and report the sending and receiving buffer sizes for the UDP sockets (SO_SNDBUF and
SO_RCVBUF). After printing the results on the screen, the program should change the send and
receive buffer sizes to some value entered by the user and report the new values again into the
screen. This step needs to be done at the beginning before start sending requests to the server
Submission:
You files should follow the following naming convention: your_group#_HW#, and contains
your ID’s as comments at the beginning of the code
Submit a zipped file containing only the course code (following the naming convention) and
a screen shot of compiling and running your code ( both client and server)
Hints/Notes:
DO NOT use the header file “unp.h” from the book
Your program for client needs to take two arguments that specify the IP address of the server
and the port that it is trying to connect to. Your program for server needs to take an argument
that specifies the port that it is listening to ( the same one provided to the client)
Some library functions that you might need: getcwd(), opendir(), readdir(), scandir()
Ask questions as early as possible.
Your programs should be compiled and run without any single error or warning.
Comment and error-check you code