bool connect(string host = "127.0.0.1", string token = "", int port = 20000)
    {
        //endpoint = protocol + "://" + host + port.ToString() + "/api/" + api_version;
        api_host = protocol + "://" + host;

        client = new UtopiaLib.Client(api_host, port, token);
        //client.api_version = api_version;
        return(client.checkClientConnection());
    }
 bool isClientConnected()
 {
     if (client == null || !client.checkClientConnection())
     {
         loger.print("No connection to Utopia client or received invalid data");
         return(false);
     }
     else
     {
         return(true);
     }
 }
Beispiel #3
0
    bool auth()
    {
        try {
            client = new UtopiaLib.Client(api_host, api_port, api_token);
        } catch (UtopiaLib.ApiErrorException apiex) {
            last_error = "api error: " + apiex.Message;
            return(false);
        } catch (SocketException socketex) {
            //TODO: solve problem with socket exception uncaught (wtf??)
            last_error = "socket exception: " + socketex.Message;
            return(false);
        } catch (System.Exception ex) {
            last_error = "catched exception: " + ex.Message;
            return(false);
        }

        return(client.checkClientConnection());
    }