CS 3733 Operating Systems, Spring 2009 Assignment 6


Due Monday, April 27

There will be a 20% penalty for not having this assignment ready at the start of class on the due date.
We will be testing your client and server with those written by other students.

Write a parallel network server that will take a port number as a command line parameter and for for each connection will read a pathname from the network and send back the word count of the corresponding file.

Have the server start (before accepting any connections) by printing a line to standard error giving your name, something like:
Network wordcount server written by ...
Each time a connection is made to the server, output a line to standard error in the form:
Connection made from ...
in which you print the name of the host that requested the connection.
Before sending the word count back to the client, print a message to standard error containing the name of the file (full path name) and the word count, such as:
1599509 t.3

The pathname should be formatted as an absolute path terminated by a newline. Use the readline function from the restart library. Send the count back to the client as a 32-bit integer in network byte order. The server should not produce any output except as indicated above.

This completely specifies the server. You must implement your server using this format. Your server should be able to work with a correctly-implement client written by any of the other students.

The server is fairly simple and should not take long to write. Model it on the serverp program from Chapter 18 of USP. You can test most of the server using the client2 program.

Write a client that will take take a port number, a directory, and a list of hosts on the command line and will farm out the corresponding filenames to the servers on those hosts. Balance the load as well as you can. The client will generate output like the programs in Assignments 5 and 6. Output should appear as it becomes available.

Create all of the connections (with the filename sent to the server), and then wait for the results to become available. The simpest way to do this is with select.

Test your client using the same directory as in the last 2 assignments, ~cs3733/s2009tests.

Be prepared to run your client and server in class on the due date.

Handing in your assignment
Use this cover sheet.
Consecutively number all of the pages you turn in.
Make sure you answer the questions that are on the cover sheet.
When you get to class on the due date, do not hand in your printout until you are asked to.