MC78 Lab 4: The Return of NetFlip (Fall 1998)
Due: December 11, 1998
Goals of the lab
In this lab, you and your partner(s) will get some experience using
RMI, the Java Remote Method Invocation facility, which is one example
of a modern distributed object system. To do this, you will rewrite
the NetFlip and FlipServer programs from lab 1 to use RMI instead of
sending bytes over sockets.
If you would rather do some other simple client/server program using
RMI, that is fine too. However, check with me on the suitability.
One aspect I would like to see is that sometimes the server contacts
the client, rather than always the client contacting the server.
Resources
You can use as starting points not only the code from lab 1, but also the RMI
documentation, which is on the web at http://java.sun.com/products/jdk/1.1/docs/guide/rmi/. In particular, this includes the RMI
Tutorial, the code from which I showed on the overhead in class.
Your friendly neighborhood instructor is also a resource.
Hints
Remember that the client and the server are quite asymmetrical. The
clients will need to find the server by name, but can then register
with the server, so that the server knows the clients without doing a
naming lookup. Similarly, when the client discovers that the server
has failed, that is quite a different matter than when the server
discovers that the client has failed.
You will be able to strip quite a bit of the existing code out of
NetFlip and FlipServer. In particular, all the multi-threading stuff
that gave you such grief in lab 1 can go. (You will still need
synchronization, but you won't need to create any threads.)
You will almost certainly find it less hassle to leave NetFlip an
application program rather than make it an applet.
Instructor: Max Hailperin