Connecting to the Server

Set credentials and .Net server options when you connect to the Server.

  1. Run the NetEspError command to create an error message store for these tasks:
    NetEspError error = new NetEspError();
  2. Set a new URI:
    NetEspUri uri = new NetEspUri();
    uri.set_uri("esp://cepsun64amd.mycompany.com:19011", error);
    
  3. Create your credentials:
    NetEspCredentials creds = new NetEspCredentials(NetEspCredentials.NET_ESP_CREDENTIALS_T.NET_ESP_CREDENTIALS_SERVER_RSA);
    creds.set_user("pengg");
    creds.set_password("1234");            
    creds.set_keyfile("..\\test_data\\keys\\client.pem");
    
  4. Set options:
    NetEspServerOptions options = new NetEspServerOptions();
    options.set_mode(NetEspServerOptions.NET_ESP_ACCESS_MODE_T.NET_CALLBACK_ACCESS);
    server = new NetEspServer(uri, creds, options);
    int rc = server.connect(error);