
GEORGEMASONUNIVERSITY
ComputerScienceDepartment
Concurrent & Distributed Software Systems -- CS 475
Spring2003
Assignment3 NetworkProgrammingusingSockets
DUEDATE–April 7
Write a HTTP 1.0 client and server
•The client and server must interact using HTTP/1.0. and
•The server must implement GET and HEAD requests from HTTP/1.0
•The server must also implement a GETLIST method. This method allows the client to request a set of documents
from the server. The idea is that the client can use the GET method to retrieve an HTML file and then use the
GETLIST method to retrieve in one exchange all the images embedded in the web page corresponding to the
HTML file. You have to design the exact formatfor a GETLIST request and response. You should follow the
general format of other HTTP 1.0 requests and responses. The client should use the Content-length field to split
the response into its components. To simplify your implementation of the client, you can assume that the server
returns an optional header in response to a GET request that includesthe names of any images embedded in the
document being retrieved.
•The server must be multi-threaded
•The server must be able to retrieve at least HTML, GIF, JPEG, and Postscript files (as implied by the usual
extensions) and return them with the appropriate “Content-Type” specification. Your server must also return
appropriate error codes – 200, 404, etc.
•The server must generate a log entry for each access by a client that shows the identity of the client as well as
other information pertaining to the access.
•The server must be configured to search for requested files in a default directory that you specify
•The client must also generate a log recording its interactions with the server (The purpo seof the client and server
logs is to assist in debugging the program, and for showing me that your program works correctly).
A typical interaction between a client and a web server, as well as the format of log entries generated by the server is
shown on the next page.
You have to implement two versions of your program. In the first version, the HTTP protocol should be imple-
mented on top of TCP, whereas in the second version, HTTPis implemented on top of UDP. (For the UDP implemen-
tation, you do not have to provide reliable transport. You can also assume that the files that will be served by the web
server are small enough to fit in one datagram.)
NOTES:
1. Choosing a server port. You will need to run a server process that can coexist with other people’s processes
in the same computer. You will need to select an agreed port number for the server to accept messages from
clients. Two servers on the same computer cannot use the same local port number. You will therefore need to
choose a port number that is different from that of other people. Note that your HTTP server will not be able to
use port 80 (unless you’rethe administrator for the machine it is running on.)
2. There are links on the class web page to the HTTP 1.0 standard. You will need to consultthese documents for
the exact format of the GET and HEAD requests and responses.
3. Solaris documentation on network programming is available at http://docs.sun.com
1