Skip to Main Content

Java APIs

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

[beginner] java socket firewall / iptables problem

843790May 16 2008 — edited May 16 2008
Hello all,
I post this question as I couldn't find similar one here, thanks in advance for the time.

So, I tried to run the example [KnockKnock client/server|http://java.sun.com/docs/books/tutorial/networking/sockets/clientServer.html] program given @ the sun socket's tutorial ...
it works on localhost, but not between two machines in the same subnet or different subnet.
I have added the port number on the iptables (firewall) list to enable binding and communication but it seems not enough ( I did restart the iptables / network services )
Line in iptables:
-A RH-Firewall-1-INPUT -m state state NEW -m udp -p udp dport 19910 -j ACCEPT
result of cmd:
netstat -a | grep 19910
when program is running
tcp 0 0 *:19910 *:* LISTEN
result of client trying to connect to server (either hostname or ipaddress or hostname.domain formats)
java.net.NoRouteToHostException: No route to host
        at java.net.PlainSocketImpl.socketConnect(Native Method)
        at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:333)
        at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:195)
        at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:182)
        at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:366)
        at java.net.Socket.connect(Socket.java:519)
        at java.net.Socket.connect(Socket.java:469)
        at java.net.Socket.<init>(Socket.java:366)
        at java.net.Socket.<init>(Socket.java:180)
        at KnockKnockClient.main(KnockKnockClient.java:44)
However, when I shutdown the iptables service the program works just fine.
Am I missing something?

K. Honsali
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jun 13 2008
Added on May 16 2008
1 comment
532 views