Java Socket Can't Connect to Own Computer -
my program works fine when do
socket s = new socket("127.0.0.1", 10000);
but when replace localhost own external ip adress, fails gives? throws unknownhostexception immediately, though can ping external ip fine. stack trace:
java.net.connectexception: connection refused: connect @ java.net.plainsocketimpl.socketconnect(native method) @ java.net.plainsocketimpl.doconnect(plainsocketimpl.java:333) @ java.net.plainsocketimpl.connecttoaddress(plainsocketimpl.java:195) @ java.net.plainsocketimpl.connect(plainsocketimpl.java:182) @ java.net.sockssocketimpl.connect(sockssocketimpl.java:366) @ java.net.socket.connect(socket.java:529) @ java.net.socket.connect(socket.java:478) @ java.net.socket.<init>(socket.java:375) @ java.net.socket.<init>(socket.java:189) @ fileclient.main(fileclient.java:29)
what gives? throws unknownhostexception immediately, though can ping external ip fine. stack trace:
i don't see unknownhostexception in stack trace. "remote" side actively refuses connection. because of firewall, unlikely, firewalls silently drop packets instead of actively refusing. likely, server application isn't listening on external interface. server software behave in default configuration due security reasons. check output of netstat -n -a
command.
Comments
Post a Comment