ihuConnectEx

Use the ihuConnectEx function to connect to a server with store and forward support.

Prototype

ihuErrorCode IHUAPI ihuConnectEx (
MSO Char * server,
MSO Char * username,
MSO Char * password,
MSO Char * buffername,
unsigned long MaxMegMemory,
unsigned long MinMegDiskFree,
long * serverhandle
);

Remarks

The inputs to this function are:

  • 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.
  • buffername: The target filename and location to store buffered data. The buffer file name must be unique.
  • MaxMegMemory: Maximum memory in MB. Buffered data is stored in this memory until it is full and is later stored to disk.
  • MinMegDiskFree: Minimum free disk space in MB.

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.

There is no 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 ihuConnectEx function returns the following values:

  • ihuSTATUS_OK
  • ihuSTATUS_FAILED
  • ihuSTATUS_API_TIMEOUT
  • ihuSTATUS_NOT_VALID_USER
  • ihuSTATUS_LIC_TOO_MANY_USERS