public void send(String msg) { try { streamOut.writeUTF(msg); streamOut.flush(); } catch (IOException ioe) { System.out.println(ID + " ERROR sending: " + ioe.getMessage()); server.remove(ID); stop(); } }
public void run() { System.out.println("Server Thread " + ID + " running."); while (true) { try { server.handle(ID, streamIn.readUTF()); } catch (IOException ioe) { System.out.println(ID + " ERROR reading: " + ioe.getMessage()); server.remove(ID); stop(); } } }