My ServerSocket listens to LAN Connections and accepts them well, but when I try to connect to the same through my Phone – using the 3G connection – it doesn’t seem to connect.
-
I tried using
getMyIPsite to get theIPand try to connect to it, it does get the rightIP(checked with my router) but then no connections are accepted at all. -
I tried opening the port on windows 7 and on my router altogether.
-
I put those lines in my Server constructor:
ss = new ServerSocket(port); host=ss.getInetAddress().getHostAddress();and I get the ip on host to 0.0.0.0
Thanks for your help.
You need to have a public IP address. If you have a router it must pass traffic for the port you want to expose to the internet to your machine. If you have a firewall, it must allow external connections to this port.
All the changes you do are the same regardless of language you use and there is nothing you can do from Java to work around needing to do these things.