An Overview:
In this project, we are going to build a web server that handles requests sent by clients. The server would run on a particular port (specified via the command line arguments) and should be able to handle multiple requests, one after another. Clients would send requests using a client application (supplied in this assignment, and is written in C). The client application would connect to the server (Server IP address and port are specified via the command line arguments) and sends a string that represents the file requested. For simplicity, assume that the web server is responsible for serving files that are named file1, file2, file3, and so on. Notice that the server does not really care about the content of these files. Use a small range of file sizes, from kilobytes ones to few megabytes ones.
If the server receives a request for a file that does not exist in its current directory, it should reply with a "FILE NOT FOUND" error. This could be another file that the server can serve back to clients. For simplicity, you may assume that the server serves files located in the same directory.
The client takes three arguments; server_IP, server_port and the file requested. The code for the client can be found here:
client.c
The Programming Part:
The server should be able to listen for requests on the port it is running on. Once a request arrives, the server should parse the string specified, locate the file requested and replies with the appropriate document. The server would print the time a request has arrived (to a millisecond granularity) and when the server has finished sending this file. The server would print the size of the file transmitted and the rate of transfer achieved.
Where to Start:
First, you need to get familiar with Internet programming API. This will be based on the material discussed in class.
Given the client application provided, start working on the server part. The client application provided prints the file size received.
To ensure correctness, the received data should be of exactly the same size as the file transmitted by the server.
What to Turn in:
You need to turn in a design document, stating the overall design decisions you made and data structures used.
Please indicate which parts of your program you know they work fine, which parts you know they do not work. Please don't make the grader guess!
Please provide a single command line to test your code and make sure to provide a working example of the command line.
The output: Your server should keep a log file, of when requests arrive (to the millisecond granularity), what files are requested, the rate at which files are being transmitted, the size of the file transmitted, and when the transmission has ended.
To provide a sample output, run 3 clients (within 5 second interval), each requesting a file and showing the server's log file.
All programs must be written in C and run on the Linux CS Servers