Defining the Client Interface

In this application, both the server and client are exporting remote objects, so the client must implement a remote interface. The server is a client in the sense that it calls the passMessage() method of client. The client exports the passMessage() method in the same way as the server exports its remote methods.

The ClientInterface declares only one method, which is used to post a message to the client.

Listing 11.3 ClientInterface.java

import java.rmi.*;

//client interface
public interface ClientInterface 
	extends Remote{

  //remote method used to post a message to the
  //client.
   public void passMessage(String message)
	throws RemoteException;

}

 

 

RMI BOOK MAIN PAGE                Top

  
Copyright © 2001 www.universalteacher.com