Did you spot the bug? The server writes to the socket using:
out.write("From server: " + nextResponse);
The client reads using:
while ((fromServer = in.readLine()) != null) {
However, the PrintWriter write method doesn’t put a carriage return at the end of the data. Hence, no matter how much data the server sends, the client will never receive any of it.
This entry was posted in Java and tagged Java. Bookmark the permalink.