Programming Assignment 3

This assignment is to be done individually. Do not show your code to others and do not look at other students' code. Prevent other students from accessing your code (do not put it in a public directory). However, you are free to use any tools you like (library, search engines), to discuss problems with others, and to seek the help of the TA or the instructor.

Objective

The objective of this assignment is to familiarize yourself with either RPC or Java RMI.

Assignment: Greatest Common Divisor

In this example you will implement a remote Greatest Common Divisor (gcd) server (gcdserver) and a client program (gcdclient) using this server. The client program has the following command-line syntax:

./gcdclient hostname prognum versnum number1 number2

The 'hostname' parameter is the host name of the remote server, 'prognum' and 'versnum' identify the server program (program and version number), and 'number1' and 'number2' are the two positive integers whose gcd the server will compute. Both client and server will use RPC to communicate, where the server implements the gcd algorithm (refer to a mathematics book or search on the Internet).

Implementation Hints

Error Handling

The following error handling is expected: all return values of the system calls have to be checked, the correct number of command-line parameters for the client, and valid numbers (positive integers). If the server cannot find the program (or version) of your RPC server, the client should notify the user of this error. Compile your code with the '-Wall' flag and make sure to remove all warnings.

Evaluation

Run your RPC program for 10 different situations (e.g., gcd(5,12), gcd(11,90), etc.). Write one script with all 10 client invocations.

Alternative Implementation

As an alternative to above specification, you can implement the RPC server as Java RMI server instead (refer to the presentation slides for implementation hints).

Grading

The grading will be according to the grading policy on the course webpage. Remember that documentation and exception handling are each worth 20% of the assignment's grade!

Submission

The due date for this assignment is March 4, 2005, 11.59pm EST. You will use the drop-off boxes (you will find a box with your login name). Make a directory called "project3" and place all required files into this directory (either individually or as one tar file). The required files are: all source files, a Makefile, one run script for the required test cases, and a document called README (ASCII file) or readme.ps or readme.pdf (postscript file), which contains a project summary, your solution approach, any encountered problems and how you solved them, any unresolved issues, and a usage explanation. The document should be not more than 2 pages.
Late submissions: 25% penalty after the deadline and another 25% for every 24h after the deadline.