Let's say the public IP of the router is
The local IP of the computer with the server is
The router is set to forward to

In the server I have:
System.setProperty( "java.rmi.server.hostname" , "" );
Registry registry = LocateRegistry.createRegistry( 5678 );
registry.rebind( "TheWebServer" , webServerInt );
The client has:
Registry registry = LocateRegistry.getRegistry( "" , 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:;

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

Any input would be greatly appreciated.