Skip to Main Content

Java Programming

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!

Client Socket Fails to Connect to ServerSocket

807580Oct 11 2009 — edited Oct 18 2009
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...
When running the client, it only prints "Establishing connection" and stops there (it never connects) and throws no exceptions whatsoever. But when I try to use telnet on the 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 others it just freezes while telnet works.

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.
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Nov 15 2009
Added on Oct 11 2009
8 comments
1,474 views