Reputation: 2725
I am playing with simple client - server app on Java. I have 2 computers. 1st one(server) is on ubuntu, the second is windows8(client). Both machines connected to the same net, same router. When I create socket on client via "short" ip - like this
socket = new Socket(InetAddress.getByName("192.168.1.7"),4444);
it works well - no issues. But when I am trying do like this -
socket = new Socket(InetAddress.getByName("95.188.199.188"),4444);
which uses public ip(as I understand). The latter one - doesn't work. Firewall - turned off. What is the problem?
Upvotes: 0
Views: 716
Reputation: 7230
Regardless of firewall, the Internet will always see your router, not your local machine; you will have to configure your router to forward the desired port to the correct local machine.
Upvotes: 2
Reputation: 4218
Because if you are inside your internal network, you cannot use the public IP.
This is usally due to the default configuration of the router. The router won't use public IPs to resolve "internal" request.
Upvotes: 4