java.net.ConnectException : Connection refused

0

In my case, I was running a server socket on 127.0.0.1 on port xyz, and trying to get my clients to connect to it. It worked on one ubuntu machine, but failed to work on another.


serverSocket = new ServerSocket(serverPort, 500, Inet4Address.getByName("127.0.0.1"));

I changed this to 

serverSocket = new ServerSocket(serverPort, 500, Inet4Address.getLocalHost());

Thats it, started to fly again… 

Advertisements

java.net.ConnectException : Connection refused

0

In my case, I was running a server socket on 127.0.0.1 on port xyz, and trying to get my clients to connect to it. It worked on one ubuntu machine, but failed to work on another.

<code>

serverSocket = new ServerSocket(serverPort, 500, Inet4Address
.getByName(“127.0.0.1”));

</code>

I changed this to 

<code>

serverSocket = new ServerSocket(serverPort, 500, Inet4Address
.getLocalHost());

</code>

Thats it, started to fly again…