> java -version
java version "1.7.0_09"
OpenJDK Runtime Environment (IcedTea7 2.3.3) (suse-3.16.1-x86_64)
OpenJDK 64-Bit Server VM (build 23.2-b09, mixed mode)
On openSUSE 12.2 (x86_64) and AppArmor is not running, and the firewall is disabled.
If server using AsynchronousServerSocketChannel is listening for connections and I specify localhost or 127.0.0.1, then it only accepts connections from the localhost and if I try to connect from another machine it rejects it. WTF?! If I instead put in the Java server its actual machine's hostname or IP address, rather than localhost or 127.0.0.1, then it does accept connections from elsewhere. Double WTF?!
There's no such issue when I use old-school synchronous server--it accepts connections from both the local machine and external ones when I have it bind to a localhost port. Moreover, I noticed the following difference between the synchronous and NIO2 when I had both set to bind to localhost:
> netstat -ltupn | grep
tcp 0 0 :::2340 :::* LISTEN 6749/java
tcp 0 0 127.0.0.1:12401 :::* LISTEN 6767/java
This is a big problem for me as I plan to deploy this server to multiple machines and it would be a major pain having to change the configuration files on every single one to add the actual hostname/IP rather than have localhost. What's the fix so it will work if I specify localhost as it should be?