R – When multiple computers have identical IP addresses, how can you connect to one of them programmatically

clientip addressnetworking

This question is a bit hard to phrase and I'm not sure if I understand the underlying issue, but here goes:
I have a java chat program. I run it using 2 jar files – a server and a client. You run the server in the background on a computer, and then when you run the client you just have to enter the ip address of the computer that's running the server and hit connect. I've used it several times before, and it has always worked. My problem now is that although I can still get it to work within our home network by using the local ip address (the one that begins with 192), I can't get it to work using the public / global ip address. I've noticed that all our home computers, which are all connected to the same modem (router?), have the same global ip address (I checked whatismyipaddress.com). Could this be the problem? If all our computers have the same IP address, how does the program know which one to go to for the server program? Any ideas on how I can get this to work?

Thanks!

Best Answer

This really belongs on serverfault. But the short answer is that you need to set up port forwarding on your router. This tells the router, for incoming requests on a given port, the internal IP address of the machine that those requests should be directed to. Check out http://www.portforward.com for detailed instructions.