Code example for ServerSocket

Methods: close, isClosed

0
   } 
 
   public void destroy() { 
      Log.d(TAG, "Destroying PairingServer " + PORT);
      try { 
         if ((this.server != null) && (!this.server.isClosed())) {
            Log.i(TAG, "Destroying Socket " + PORT);
            this.server.close();
            this.server = null;
         } 
         this.interrupt();
      } catch (IOException e) {
         Log.w(TAG, e);
      } 
   } 
 
   public void run() { 
      try { 
         // start listening on a specific port for any requests 
         Log.i(TAG, "Starting Socket Server on Port " + PORT);
         this.server = new ServerSocket(PORT);