Пример #1
0
 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();
     }
   }
 }
Пример #2
0
 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();
   }
 }