CodingForums.com

CodingForums.com (http://www.codingforums.com/index.php)
-   Java and JSP (http://www.codingforums.com/forumdisplay.php?f=54)
-   -   Trouble connecting to an RMI server which is behind a router (http://www.codingforums.com/showthread.php?t=209786)

JoolsC 11-20-2010 11:15 PM

Trouble connecting to an RMI server which is behind a router
 
Let's say the public IP of the router is 92.1.85.179
The local IP of the computer with the server is 192.168.0.2
The router is set to forward 92.1.85.179:5678 to 192.168.0.2:5678

In the server I have:
Code:

System.setProperty( "java.rmi.server.hostname" , "92.1.85.179" );
Registry registry = LocateRegistry.createRegistry( 5678 );
registry.rebind( "TheWebServer" , webServerInt );

The client has:
Code:

Registry registry = LocateRegistry.getRegistry( "92.1.85.179" , 5678 );
server = (WebServerInterface) registry.lookup( "TheWebServer" );

When client is on the network local to the server it's ok. When the client is outside the local network it gets java.rmi.ConnectException: Connection refused to host: 192.168.0.2;

Obviously the server is giving the client the IP of 192.168.0.2 as it doesn't appear in the code, which I thought System.setProperty( "java.rmi.server.hostname" , "92.1.85.179" ); was supposed to change.

Any input would be greatly appreciated.


All times are GMT +1. The time now is 06:19 PM.

Powered by vBulletin®
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.