Java and Remote Method Invocation
In the last chapter we looked at how an applet could communicate with a server application using sockets. This approach is relatively straight forward to use and exploits the widely adopted Sockets communication model. However, Java offers another way of enabling Java programs (both applets and applications) to communicate — Remote Method Invocation (or RMI). Indeed, RMI is surprisingly simple to use and may well be preferable to sockets for Java-to-Java communication. This is because the resulting software is simpler and easier to maintain than using sockets. For example, a distributed software system resembles a software system executing within a single virtual machine except for the addition of one line to a client and two lines to a server! Note that all RMI classes are in the java.rmi package or one of its subpackages, such as server.
Unable to display preview. Download preview PDF.