12.07.2015 Views

RPC, RMI and CORBA

RPC, RMI and CORBA

RPC, RMI and CORBA

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

package client;import java.rmi.registry.LocateRegistry;import java.rmi.registry.Registry;import java.rmi.<strong>RMI</strong>SecurityManager;import common.Hello;public class Client {private Client() {}public static void main(String[] args) {System.setSecurityManager(new <strong>RMI</strong>SecurityManager());}}String host = (args.length < 1) ? "localhost" : args[0];try {Registry registry = LocateRegistry.getRegistry(host);Hello stub = (Hello) registry.lookup("Hello");String response = stub.sayHello();System.out.println("response: " + response);} catch (Exception e) {System.err.println("Client exception: " + e.toString());e.printStackTrace();}

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!