Java RMI - My client can not connect to server outside home network

Started by
2 comments, last by ChexWithRaisins 12 years, 3 months ago
I am developing an online CCG (collectible card game) using Java. Currently the game uses Java's RMI to allow players to send their moves to the server. It works fine so long as the client applications are run from a computer within my home network. However I can not figure out how to access the server when off of my network.

I recently purchased a server machine with Windows Home Server installed. I gave the machine a static IP within my network, and forwarded ports 80, 443, 4125 and 1099 (the default RMI port) to that IP. The OS on the server has Remote Web Access set up (I'm not sure if this is relevant). However I am not sure what host name to have the client connect to; I've tried the Remote Web Access domain name, and the IP found at whatismyip.com, and neither seemed to work.

What are the steps that I need to take in order to make my server visible outside my home network, so that the clients can access the server's RMI methods?
Advertisement
First, you should look at firewall, port forwarding and NAT introduction links in the FAQ, as well as the question of "how do clients find my server?"

Second, try using Wireshark on the client when it's outside the firewall, to verify which port it's trying to use. Then make sure that's properly forwarded on your router/firewall, to your internal server address, and also that the firewall on the router and on the server box are correctly set to allow these connections.

Third, RMI is not a great general-purpose networked game protocol. It is usually verbose and usually has security issues. I'm not saying you should change it right now, just that you should be aware and plan to mitigate whatever problems may arise.
enum Bool { True, False, FileNotFound };
You ether you need to manually do the port forwarding on your Firewall/Router like hplus0603 suggest, or you need to add in a UPnP Nat API so that it can do it automatically.

First, you should look at firewall, port forwarding and NAT introduction links in the FAQ, as well as the question of "how do clients find my server?"

Second, try using Wireshark on the client when it's outside the firewall, to verify which port it's trying to use. Then make sure that's properly forwarded on your router/firewall, to your internal server address, and also that the firewall on the router and on the server box are correctly set to allow these connections.

Third, RMI is not a great general-purpose networked game protocol. It is usually verbose and usually has security issues. I'm not saying you should change it right now, just that you should be aware and plan to mitigate whatever problems may arise.


Thank you for your response, I started off by reading the FAQ on the site. I found the FAQ very helpful and informative, however it did not lead me to the solution to my issue. I will try the Wireshark application as you suggest to see what results it yields. In the meantime, you suggested that RMI is not the optimum solution. I am not married to the idea of RMI, its actual footprint on my overall program is very minimal, so I'd be open to better alternatives. Bear in mind though that since my game is a CCG, the calls between client and server typically average one every few seconds, which is probably much less than typical games.

Thanks!

This topic is closed to new replies.

Advertisement