ihuConnect

Use the ihuConnect function to connect to a Historian server. The function provides a server handle to be used in subsequent calls.

Prototype

ihuConnect {
 in MSO MSO Char * server,
 in MSO MSO Char * username, in MSO MSO Char * password, out long * serverhandle
};

Remarks

The inputs to the function are server, username, and password. Each has a default value if NULL is passed.

  • server: If NULL is passed, then the connection attempt is to the local machine.
  • username and password: If NULL is passed, then the username that owns the process is used. Most of the time this is the same as the user logged into the operating system. However, in the case of a program running as a service, you can specify a username and password that the process should use.

The output of this function is a server handle.

Server handles are valid only during the lifetime of the process. They should not be saved to a file and reused.

You do not need to call ihuConnectEx more than one time for a username and password. If the connection to the server was lost and restored, the handle can be used after reconnection. If the server was not available at connect time, a handle is still returned, which you can use as soon as the connection becomes available. Reconnects are performed inside the API. The application should wait and retry reads and writes with the returned server handle. Reads and writes succeed after the underlying connection is re-established.

You should still call ihuDisconnect with the returned server handle, even if an error is returned.

A connection to the server consumes a Client Access License (CAL) only if you have not already accessed the server from your current IP address. There is no way to connect without consuming a CAL.

Returns

The ihuConnect function returns the following values:

  • ihuSTATUS_OK
  • ihuSTATUS_FAILED
  • ihuSTATUS_API_TIMEOUT
  • ihuSTATUS_NOT_VALID_USER
  • ihuSTATUS_LIC_TOO_MANY_USERS