public void run() // loop utama, utk nerima user input n kirim ke server&client laen { while (thread != null) { try { String a = console.readLine(); String b = cryptor.encrypt(a); streamOut.writeUTF(cryptor.encrypt(a)); streamOut.flush(); } catch (IOException ioe) { System.out.println("Sending error: " + ioe.getMessage()); stop(); } } }
public void handle(String msg, int tes) // fungsi print message & exit jika ada command exit { String dMsg = cryptor.decrypt(msg); if (dMsg.equals(".bye")) { System.out.println("Good bye. Press RETURN to exit ..."); stop(); } else // edited { System.out.println("Client" + tes + " : " + dMsg); System.out.println("(" + msg + ")"); System.out.println(); } }