I wrote a RMI server and a RMI client. The client calls some methods on the server and the server keeps a reference of the client to send some events.
Everything works great on the local network.
I tried to run it over the internet and in order to do so, set the property java.rmi.server.hostname=[public-ip-of-the-server-router]. I now have two different problems.
1 - For the server to be able to call back the client, I had to set the java.rmi.server.hostname=[public-ip-of-the-client-router] and forward the port 1099 to the client machine on the client router. I would like to be able to avoid that so that anyone could run the client without having to worry about router port forwarding. Ideally the customers could run the client anywhere and we can't excpect them to know how to configure a router.
2 - If I set java.rmi.server.hostname to the public ip on the server, it is no more available to the eventual clients that could run on the same local network as the server. That is because the public ip is not qualified from within the network. Is there a way to have the server available both on the public ip and the LAN ip?
2 confuses me - why can't clients on the network access the public IP of the server? Wouldn't this just require changing router configuration to allow them to?
Write once, run anywhere, because there's nowhere to hide! - /. A.C.
Joined: Feb 08, 2005
Thanks for your answer.
For the first point, I thought it might be the case and I removed the callbacks and replaced the RMI event propagation by a socket client-server system.
For the second point, it's because the routers of the networks where we want to install our system don't support that feature. They are cheap and nasty, and are installed in so many locations that we can't even start thinking about replacing them.
subject: RMI Server and Client behind two different routers