October 12th, 2009, 05:06 AM
Client Socket Fails to Connect to ServerSocket
I have a server socket listening on port 5077 and waiting for client connections
where ServerThread is a class extending Thread which processes the client connection.
boolean listening = true;
On the client side, I have the following:
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.
socket = new Socket(serverAddress, 5077);
out = socket.getOutputStream();
// the rest of the code here...
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.
Tags for this Thread
Click Here to Expand Forum to Full Width
This a Codeguru.com survey!