@Override
    public void run() {
        while (true) {
                try {
                    synchronized (com) {
                        connection.setSoTimeout(10000);
                        dos.writeInt(Constants.PROBE);
                        dis.readInt();
                        if(!connection.isConnected())
                            break;
                        com.wait(10000);
                        if(dis == null)
                            break;
                    }
                } catch (IOException e) {
                    try {
                        e.printStackTrace();
                        DebugPrint.print("calling disconnect");
                        iface.disconnect();
                    } catch (Exception e1) {
                        e1.printStackTrace();
                    }
                    break;
                } catch (InterruptedException e) {
                    try {
                        e.printStackTrace();
                        DebugPrint.print("calling disconnect");
                        iface.disconnect();
                    } catch (Exception e1) {
                        e1.printStackTrace();
                }
                break;
                }
        }
    }