Explanation

The RemoteClientImpl class extends JFrame and implements the ClientInterface. The setup() method is used to create various components and to show the main window. The register() method is called by the setup() method to register the client with the server. First, the method gets a remote reference by looking up the registry. Because the client is not a subclass of the UnicastRemoteObject class, it must explicitly export its objects. The exportObject() method is used to export objects explicitly. Once the object is exported, get the client registered with the server. The passMessage() method is called by the remote server to post messages to the client. It takes a string object as its argument. The method appends the message received to the end of text area.

The ButtonHandler class implements the ActionListener interface. When the user clicks the "Send Message" button, the actionPerformed() method of this class is invoked. The actionPerformed() method calls the passMessage() method of the sever, clears the text area, and sets the focus on the text area.


Note

Multithreading is not implemented on the client side. You should try to implement it yourself.


Create Stub and Skeleton classes using RMIC

c:\Remoteclient> rmic RemoteServerImpl RemoteClientImpl

 

 

 

RMI BOOK MAIN PAGE                Top

  
Copyright © 2001 www.universalteacher.com