3.1 - Timeout Configs | LabJack
 
« Close

Datasheets and User Guides

App Notes

Software & Driver

 

3.1 - Timeout Configs

Timeout Configs Overview

All timeouts are in units of milliseconds.

Open timeouts:

These timeouts control how long LJM waits for responses from a network broadcast.

LJM_OPEN_TCP_DEVICE_TIMEOUT_MS may be used to set both open timeouts at the same time.

Command-Response send / receive () timeouts:

These timeouts control the maximum amount of time LJM will wait for a response during command-response communication.

LJM_SEND_RECEIVE_TIMEOUT_MS may be used to set all three send / receive timeouts at the same time.

Stream receive timeout:

These configs control how LJM waits for packets during stream.

These configs are especially relevant to externally-clocked stream.

Details

One command-response operation (as performed by a function like LJM_eReadName, for example) may take longer than the timeout for that connection type. This is because there are multiple timeout periods -- one to send the command and another to receive the response.

Setting a new timeout value will not affect pending timeouts.

Setting a timeout value to 0 sets an infinite timeout.

Relevant Functions

To read a timeout config, use LJM_ReadLibraryConfigS.

To write a timeout config, use LJM_WriteLibraryConfigS or LJM_LoadConfigurationFile.

Example

[C/C++] Read LJM_ETHERNET_SEND_RECEIVE_TIMEOUT_MS, set LJM_ETHERNET_SEND_RECEIVE_TIMEOUT_MS, then read it again

char ErrorString[LJM_MAX_NAME_SIZE];
double Value = 0;
int LJMError = LJM_ReadLibraryConfigS(LJM_ETHERNET_SEND_RECEIVE_TIMEOUT_MS, &Value);
if (LJMError != 0) {
    LJM_ErrorToString(LJMError, ErrorString);
    printf("LJM_ReadLibraryConfigS error: %s\n", ErrorString);
}
printf("The default for LJM_ETHERNET_SEND_RECEIVE_TIMEOUT_MS is %.00f milliseconds\n", Value);

Value = 3000;
printf("Setting LJM_ETHERNET_SEND_RECEIVE_TIMEOUT_MS to %.00f milliseconds\n", Value);
LJMError = LJM_WriteLibraryConfigS(LJM_ETHERNET_SEND_RECEIVE_TIMEOUT_MS, Value);
if (LJMError != 0) {
    LJM_ErrorToString(LJMError, ErrorString);
    printf("LJM_WriteLibraryConfigS error: %s\n", ErrorString);
}

LJMError = LJM_ReadLibraryConfigS(LJM_ETHERNET_SEND_RECEIVE_TIMEOUT_MS, &Value);
if (LJMError != 0) {
    LJM_ErrorToString(LJMError, ErrorString);
    printf("LJM_ReadLibraryConfigS error: %s\n", ErrorString);
}
printf("LJM_ETHERNET_SEND_RECEIVE_TIMEOUT_MS is now %.00f milliseconds\n", Value);

Possible output:

The default for LJM_ETHERNET_SEND_RECEIVE_TIMEOUT_MS is 2000 milliseconds
Setting LJM_ETHERNET_SEND_RECEIVE_TIMEOUT_MS to 3000 milliseconds
LJM_ETHERNET_SEND_RECEIVE_TIMEOUT_MS is now 3000 milliseconds

For more LJM configurations, see Library Configuration Functions.