public void disconnect(){

        try {
            if(input != null) input.close();
        }
        catch(Exception e) {}
        try {
            if(output != null) output.close();
        }
        catch(Exception e) {}
        try{
            if(socket != null) socket.close();
        }
        catch(Exception e) {}

        if (gui != null)
            gui.connectionFailure();

    }