I'm trying to put together a simple Chat client/server application. The issue I'm having is with the Server app. I have a class that extends Thread which contains this call: temp = input.readLine() in the run() method. Everytime I connect with the client side app, an instance of this class "ReceivingThread" is created and is supposed to read in any messages coming in using a BufferedReader. That's the input variable type. According to the API readLine() is supposed to return null when there's nothing more to read in. In my code I check for null but it never seems to leave the while loop.
Originally posted by Alan Shiers: According to the API readLine() is supposed to return null when there's nothing more to read in.
Close. It returns null when the stream reaches EOF. It blocks when there's nothing more to read. You probably need to close the stream on the other end.