/** to handle only the dosconnection of the user */ public synchronized void disconnectUser() throws Exception { HandleUser.deleteUser(getNickName()); listeningThread.disconnect(); talkingThread.disconnect(); talkingThread.notifyTalking(); socket.close(); }
/** to start the listening and the talking thread */ public void startProcess() throws IOException { if (listeningThread == null) { listeningThread = new Listening(socket.getInputStream(), this); listeningThread.start(); } if (talkingThread == null) { talkingThread = new Talking(socket.getOutputStream(), this); talkingThread.start(); } }
/** * to add responses to the list of responses to send back to the client * * @param messages the messages to add */ public synchronized void addResponses(Message[] messages) { talkingThread.addResponses(messages); }