2

I am using following code to bind a SocketChannel to a port.

private ServerSocketChannel channel;
channel = ServerSocketChannel.open();
channel.bind(new InetSocketAddress(<MachinesPublicNameAsString>,<portBeyond1024>));
channel.configureBlocking(false);

At one machine this same code executed with same privilege level binds socket to public IP of the machine. Whereas on other it binds it on 127.0.1.1. MachinesPublicNameAsString is the one with which I am able to ssh from other machines.

Please suggest me what could be wrong? What all system settings I should check for?

PHcoDer
  • 1,166
  • 10
  • 23
  • Where is your evidence for this claim? – user207421 Aug 03 '16 at 23:42
  • @EJP I retrieve the socket associated with channel by .socket() call and then, print the address associated with the socket by .getLocalAddress and getPort() calls. Also other machines are not able to connect to the machine which is binding on 127.0.1.1, they throw connection refused exception. Another evidence, when I do netstat -tpln. I see that the port is with which I tried to bind the channel, shows address as 127.0.1.1 – PHcoDer Aug 04 '16 at 17:28
  • Anything different about the `/etc/hosts` or `/etc/resolv.conf` on the host that doesn't work vs. the one that does? My guess is it is a host name resolution issue (DNS). – Drew MacInnis Aug 12 '16 at 00:55

0 Answers0