I don't know if this will help, but here is what I did last year in my
second year networking subject.
Essentially to catch you up to what is happening is that the server has
threaded this process. When it receives a IOException because someone
had left the server it Excepts and then runs the finally part of the
try/catch/finally.
I don't know how prop
public void run() {
String thisLine;
try {
thisLine = br.readLine();
user = thisLine;
client.setUsername(user);
joinSend(this.user);
thisLine = br.readLine();
while (thisLine != null) {
broadcast(this.user, thisLine);
thisLine = br.readLine();
}
} catch (IOException e) {
if (debug) System.err.println("Removing
this user + :"+this.user);
} finally {
synchronized (clients) {
clients.remove(this);
partSend(this.user);
}
}
}