Running an RMI registry on one computer and connecting to it from another

Posted by Hippopotamus on Stack Overflow See other posts from Stack Overflow or by Hippopotamus
Published on 2010-04-11T18:33:42Z Indexed on 2010/04/11 18:43 UTC
Read the original article Hit count: 265

Filed under:
|
|

Hello.

I am doing a student assignment, using java RMI. I've programmed a simple RMI-server application that provides method which return some strings to the client.

When I start the server on localhost and connect to it by client on the same computer, everything goes well.

However, I am not able to do this between two computers on home network. The computers both have no trouble of connecting by a simple C program with similar functionality, so I guess the problem is with JVM here.

I am binding the class to rmiregistry with

try{
ComputeImpl R = new ComputeImpl(); 
Naming.rebind("rmi://localhost/ComputeService",R);
}
catch(Exception e){
System.out.println("Trouble: " +e);
}

And I'm doing the lookup for RMI registry in the client application with providing the argument while launching the application:

StringBuffer rmi_address = new StringBuffer();      
rmi_address.append("rmi://").append(args[1]).append("/ComputeService");
Compute R = (Compute) Naming.lookup(rmi_address.toString());

Is the problem with my code or with JVM?

Thanks in advance.

© Stack Overflow or respective owner

Related posts about rmi

Related posts about network