Server ImplementationLisitng 6.6 InfoServerImpl.javaimport java.rmi.*; import java.rmi.server.*; //Server implementation public class InfoServerImpl extends UnicastRemoteObject implements InfoInterface { //Constructor public InfoServerImpl() throws RemoteException { System.out.println("Creating Server Object"); } //Remote method implementation public String getInfo() throws RemoteException,ServerNotActiveException{ String msg="CLIENT INFO\n"; //Return the hostname of the current client. msg += getClientHost(); return msg; } //main method public static void main(String args[]) { try { The getInfo() method of the server calls the getClientHost() method of the RemoteServer class. The getClientHost() method returns the hostname of the current client.
|
||
|
||
Copyright © 2001 www.universalteacher.com |
||