I am getting a flushing problem. I am spawning a threaded handler from the server side where I pass the socket reference to handle the communication.
On the server side, while shutting down I tried the two methods I pasted above to close client sockets(handler) thread .But the problem persists. I am unable to receive the "SHUTDOWN" string at the client end using either of the two methods above. Kindly advice. Regards, Anand Kapadi
I apologize. I thought you had an infinite loop in your server code. Please Use Code Tags in the future to preserve your code formatting. As for your problem, I know BufferedWriter will need to be flushed after writing data to it. PrintWriter should work the way you have it coded (autoflush = true and using println()). If you don't see the results you expect, I recommend adding a bunch of logging to make sure your code is doing what you think it is doing. The java.util.logging API makes this easy to manage.