Chapter 11 |
||||
Remote Client
In all the previous chapters, the server class extended the UnicastRemoteObject and implemented a RemoteInterface. The server was responsible for:
creating one or more instances of the remote object, and This chapter shows an example in which the client also exports remote objects. Both the server and client act as client and server. The source code needed for this example is stored in the examples\Remoteclient directory. The "Remoteclient" directory contains the following files:
Server ArchitectureThe design of the server is simple. The server starts a registry service and registers itself with the registry. It exports a method to enable a client to get registered, and post messages to the server. When a client registers itself, it passes a reference to itself. The server uses the client reference to pass messages to client. The client makes an initial contact with the server via a registry service, and passes a reference to itself by calling a remote method. The server and client use a String
object to pass messages. A thread object is created to send messages.
|
||||
|
||||
Copyright © 2001 www.universalteacher.com |
||||