I have a server socket listening on port 5077 and waiting for client connections
boolean listening = true;
while (listening)
     new ServerThread(server.accept()).start();
where ServerThread is a class extending Thread which processes the client connection.

On the client side, I have the following:
System.out.println("Establishing connection");
socket = new Socket(serverAddress, 5077);
System.out.println("Get stream...");
out = socket.getOutputStream();
// the rest of the code here...
On a client PC, when running the client, it only prints "Establishing connection" and hangs there (it never connects); it throws no exceptions whatsoever. But when I try to use telnet on the same client PC to the server address on port 5077 it works correctly which is completely strange. The client already works on other PCs, but on some others it just hangs while telnet works.

Another revelation is that I tried logging on the same PC using a different user and tried the client which worked successfully and was able to connect. I tried the same user on a different PC and it also worked. So what could possibly be the problem??

I've been trying to solve this for a while now but nothing worked, would be very kind if someone could point out what to do.

Thank you.