Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

RMI Server and Client behind two different routers

 
bertrand moulard
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello

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?

Many thanks in advance.

Bertrand
 
Nathan Pruett
Bartender
Posts: 4121
IntelliJ IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
1 is going to be very difficult - the answer to "So what do I have to do to get RMI to operate through two firewalls?" in Sun's RMI FAQ really discourages use of client-side callbacks for exactly this reason. There *are* things you can do, but unfortunately, most (if not all) will require either some up-front client-side configuration.

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?
 
bertrand moulard
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.

Thanks again

Bertrand
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic