Connecting to a Server

When you have started the SDK, connect to a server.

Prerequisites
Start the SDK.
Task
  1. Create a URI object:
    NetEspUri uri = new NetEspUri();
    uri.set_uri("esp://myserver:19011", error);
  2. Create your credentials. The type of credentials depends on which security method is configured with the cluster:
    NetEspCredentials creds = new NetEspCredentials(NetEspCredentials.NET_ESP_CREDENTIALS_T.NET_ESP_CREDENTIALS_SERVER_RSA);
    creds.set_user("auser");
    creds.set_password("1234");
    creds.set_keyfile("..\\test_data\\keys\\client.pem");
    
  3. Set options:
    NetEspServerOptions options = new NetEspServerOptions();
    options.set_mode(NetEspServerOptions.NET_ESP_ACCESS_MODE_T.NET_CALLBACK_ACCESS);
  4. Connect to the server:
    server = new NetEspServer(uri, creds, options);
    int rc = server.connect(error);