ihuSetConnectionParameters

Use the ihuSetConnectionParameters function to set the socket connection timeout.

Prototype

ihuSetConnectionParameters {
in IHU_CONNECTION_PARAMETERS*Params
};

Remarks

The input to the function is IHU_CONNECTION_PARAMETERS structure to pass in a connection timeout:

/* Client-side, global connection parameters */
typedef struct {
int Size; // Structure size in bytes
int TCPConnectionWindow; // Max time to establish a TCP connection with server in seconds (default 5s)
} IHU_CONNECTION_PARAMETERS;

The default connection timeout is 5 seconds. There is no maximum value, but it is not recommended to set the value to longer than 60 seconds. If you increase the timeout, server connection attempts take more time to return if the server is unavailable.

Sample Code

If an archiver is too busy to process connections, you can set a longer timeout by using the following code:

IHU_CONNECTION_PARAMETERS params;
params.Size = sizeof(IHU_CONNECTION_PARAMETERS);
params.TCPConnectionWindow = 30; // extend window to 30s
ihuSetConnectionParameters(&params);
Note: This code applies only to the connections made from your program. You must make this call each time you run your program.

Returns

The ihuSetConnectionParameters function returns the following values:

  • ihuSTATUS_OK
  • ihuSTATUS_FAILED