cours0708/A61/Client.java

19 lines
610 B
Java

import java.rmi.* ;
import java.net.MalformedURLException ;
public class Client {
public static void main(String [] args) {
if (args.length != 1) {
System.out.println("Usage : java Client <machine du Serveur:port du rmiregistry>");
System.exit(0);
}
try {
Message b =(Message) Naming.lookup( "rmi://" + args[0] + "/Message" );
System.out.println("Le client recoit : " + b.messageDistant());
}
catch (NotBoundException re) { System.out.println(re) ; }
catch (RemoteException re) { System.out.println(re) ; }
catch (MalformedURLException e) { System.out.println(e) ; }
}
}