Exemplo n.º 1
0
 private void connectToAgent() {
   // for (int i = 0; i < 10; i++) {
   // try {
   // s = new Socket("127.0.0.1", PORT);
   // break;
   // } catch (Exception s) {
   // try {
   // Thread.sleep(1000);
   // } catch (InterruptedException e) {
   // return;
   // }
   // }
   // }
   System.out.println("Desktop => device socket connected");
   screencapture.start();
   // try {
   // os = s.getOutputStream();
   // } catch (IOException e) {
   // throw new RuntimeException(e);
   // }
 }
Exemplo n.º 2
0
 public void close() {
   try {
     if (os != null) {
       os.write("quit\n".getBytes());
       os.flush();
       os.close();
     }
     s.close();
   } catch (Exception ex) {
   }
   screencapture.interrupt();
   try {
     s.close();
   } catch (Exception ex) {
   }
   try {
     synchronized (device) {
       /*
        * if(device != null) device.removeForward(PORT, PORT);
        */
     }
   } catch (Exception ex) {
   }
 }