EE 607 Spring 2008 Project 1

Due date:  See EE 607 Spring 2008 Project Web Page

For this assignment you will write (actually modify) C code for a client and server.

The server will serve files. It should be located in one of your UNIX accounts and in its own directory. In the directory, you should also have the following text files (these can be downloaded by clicking them):

  1. file1.txt
  2. file2.txt
  3. file3.txt

The client will get a file from the server and print it out on the terminal. If the file is not found then the client prints out a corresponding message. The following is an example of using a client, assuming its executable has been renamed "getfile". Shown in red are what was typed in, and shown in green are the responses from the computer.

getfile file1.txt

Aloha!

You have reached file 1.
This means that your client and server works at least partially.
Congratulations!!

Adios

getfile whoa

File "whoa" not found


Instruction

by tar'ing and gzipping it.  tar is a UNIX command to combine all files in a UNIX directory into a single file.  The command to tar a directory is

tar cvf  Name.tar Dir

where "Dir" is the directory to be tarred, and "Name.tar" is the name of the new file.  For all your assignments, label the directory "YourNameProjectX", where YourName is your family name then given name, and Project X is the current project, e.g., SmithTomProject1".  To untar a file, enter

tar xvf Name.tar

Now, gzip is the compression algorithm for UNIX.  To compress a file, enter

gzip file

which will produce a file "file.gz".  To uncompress the file, enter

gunzip file.gz

Hints:

gcc client.c -lnsl -lsocket -lresolv