Exemple #1
0
 public void start()
     throws
         IOException // awal saat client dbuka. buat input dan output stream dan start thread utama
       // client
     {
   console = new DataInputStream(System.in);
   streamOut = new DataOutputStream(socket.getOutputStream());
   if (thread == null) {
     client = new ClientThread(this, socket);
     thread = new Thread(this);
     thread.start();
   }
 }
Exemple #2
0
 public void stop() {
   if (thread != null) {
     thread.stop();
     thread = null;
   }
   try {
     if (console != null) console.close();
     if (streamOut != null) streamOut.close();
     if (socket != null) socket.close();
   } catch (IOException ioe) {
     System.out.println("Error closing ...");
   }
   client.close();
   client.stop();
 }