Programming Assignment 3
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
- Write the 'normal' (local functions only) version of the program first.
In anticipation of using RPC, you should implement the gcd algorithm in a
separate function with a single argument.
- Create a specification file (.x file) to define the program, version, and
procedure numbers as well as the procedure prototype, the argument, and the
return value.
- Generate the code templates with rpcgen (hint: use the -a flag to
also obtain sample client and server files!)
- Move the gcd function to the server code and finish the server and client
implementation.
- Generate the programs and test your RPC server.
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 (you can find a few slides
with some tips on Java RMI here).
A team that submits both an RPC and a Java RMI
implementation will receive up to 20% extra credit.
Submission
The due date for this assignment is April 2, 2009, 11am 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.