Skip to main content

Creating a Secure Connection to Key Services

To create a connection to an Pi Soft kS, use the TEConnection class as follows:

  1. Call the createInstance() method to create a smart pointer to a TEConnection object of SecureConnection type.
  2. Create a user authentication context and call the open() method of the TEConnection object to open a connection providing the server name, port number, and the context. For native user you can call the open() method of the TEConnection object with the server name, port number, username and password.
  3. Close it with the close() method when you have finished working with the connection.

The TEConnection object will be destroyed automatically when the smart pointer goes out of scope, so there is no need to delete it explicitly.


Code Samples

See the C++ environment settings for details on setting the project environment.


cpp_admin_connect.cpp

The following example illustrates how to create a secure connection to a Key Server with a native user

The complete source for this sample, together with its console output, is published in the SDK reference and is the maintained copy:

cpp_admin_connect.cpp