How can I find when a connection is closed?
I have developed an application which allows you to send messages to a "group chat", however there is an error when one of the connections closes, obviously.
I want to know how to handle this error, for example, remove the PrintWriter from the ArrayList of the person who closed their connection.
How do I do this?
public void run()
{
String message;
try {
while ((message = reader.readLine()) != null) {
send(message);
}
} catch (Exception e) {
}
}