I am trying to make a socket connection to an ip:port and it all works correctly on one of my computers. The client first connects to the server with a socket connection to log in; after that it expects incoming connections from the server and they are successful.
But, when I tried it on another computer, the client made the first connection to log in successfuly, and then waited for incoming connections. On the server side where the connections would be initiated I got this message:
java.net.NoRouteToHostException
and the incoming connection failed.
Why would that happen? Could it be a firewall issue?
s = new Socket(id, 4446);
BufferedWriter out1 = new BufferedWriter(new OutputStreamWriter(s.getOutputStream()));
BufferedReader in1 = new BufferedReader(new InputStreamReader(s.getInputStream()));
thats the 46-th line
java.net.NoRouteToHostException: No route to host: connect
at java.net.PlainSocketImpl.socketConnect(Native Method)
at java.net.PlainSocketImpl.doConnect(Unknown Source)
at java.net.PlainSocketImpl.connectToAddress(Unknown Source)
at java.net.PlainSocketImpl.connect(Unknown Source)
at java.net.SocksSocketImpl.connect(Unknown Source)
at java.net.Socket.connect(Unknown Source)
at java.net.Socket.connect(Unknown Source)
at java.net.Socket.<init>(Unknown Source)
at java.net.Socket.<init>(Unknown Source)
at sample_server.doComms.run(doComms.java:46)
at java.lang.Thread.run(Unknown Source)