It's not a secret anymore!
The moose likes Sockets and Internet Protocols and the fly likes Problem from a networking newbie Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Sockets and Internet Protocols
Bookmark "Problem from a networking newbie" Watch "Problem from a networking newbie" New topic

Problem from a networking newbie

Sven Thor
Ranch Hand

Joined: Jan 31, 2004
Posts: 34
I have problems when I try to run this simple textbook-like example.
The server starts ok. Writing data from the client to the server is ok. The server receives string and is supposed to write a string back to the stream connected to the client. However, the client hangs when it tries to read the result from the stream. I do not see why ?

I would think this would work without multithreading the server or using callbacks.


Joe Ess

Joined: Oct 29, 2001
Posts: 9189

You are reading until the end-of-stream:

But you aren't terminating the output stream on the client or the server. You can do that by invoking close() on the output stream or shutdownOutput() on the socket.

[How To Ask Questions On JavaRanch]
I agree. Here's the link:
subject: Problem from a networking newbie
jQuery in Action, 3rd edition