Your boss was really happy with your previous client-server fortune application, but now that this service is available, the users have been complaining about limited features. All the complaints and suggestions were collected and it is now your task to upgrade the software to meet the new specifications.
One things that is VERY important is that old clients need to continue to work as before, regardless of whether they are communicating with your old server or your new server. Also, your new server may be contacted by either your old clients or your new clients.
Here are a list of features that want to see:
Besides the user requests, your boss also has a request because she wants to keep track of usage of this service. She is afraid that people are spending too much time just reading fortunes. Furthermore, she wants to be able to add access restrictions to the service.
In completing this assignment, you need to follow the following steps:
In order to satisfy the users' request to not have to specify a server name and port number, you need to use a configuration file. This file should contain information that both the server and client can use. However, it should still be possible to specify all the appropriate information that is contained in the configuration file on the command lines of the client and server.
The configuration file needs to be easy to understand and modify. Comments should be allowed and the order of information in this file should not matter.
Both the client and server need to be able to find the configuration file. They both need to look for it in the following order (and stop looking when found):
Both the client and server need to be able to recognize several command line options. These options need to be parsed using one of the following methods:
Keep in mind, that if you are going to reinvent the wheel by writing your own argument parser, it needs to be in its own separate library and have its own documentation.
Both programs need to have some way to letting the user know how to use it. This is normally done by using something like "-h" or "-help". The information displayed should be short but complete. You may NOT use a datafile to contain this information.
Besides the options you need to add for dealing for configuration, the client need to recognize the following new options:
The server needs to be able to start the fortune program with an optional -o argument to get an offensive fortune.
There may be cases in which the fortune program is not available or that access to fortunes is restricted for certain clients. The server should report an appropriate error to the client in this case.
Even though this project is not large, you are expected to reuse large parts of it. To make the reuse easier later on, you should follow some rules now:
As before you will need to turn in three copies of your work. Printouts should be on 8.5 x 11 paper and each set should be stapled together. Documentation should preferably be written using a word processor or other text formatting tool. Source code should be laser printed using either enscript -2rGor vgrind .
The order of pages is important. Please use the following order:
Good luck.
Send any questions to Andrew@sdsu.edu or Whitney@cs.sdsu.edu