public void close() {
      TcpThread=false;
        try {
            socket.close();
        } catch (IOException ex) {
            Logger.getLogger(TcpIp.class.getName()).log(Level.SEVERE, null, ex);
        }
      tcpThread.interrupt();
    }