Skip to main content
Skip table of contents

LJM Timeout Configs

All timeouts are in units of milliseconds.

ListAll timeouts

These timeouts control how long LJM waits for a response to ListAll requests.

LJM_LISTALL_TIMEOUT_MS_ETHERNET

LJM_LISTALL_TIMEOUT_MS_ETHERNET is a numerical readable-writable LJM library configuration which sets how long in milliseconds LJM waits for a response to an Ethernet connection discovery request.

The constant LJM_LISTALL_TIMEOUT_MS_ETHERNET can be used interchangeably with the string "LJM_LISTALL_TIMEOUT_MS_ETHERNET".

The default timeout is 900 ms.

LJM_LISTALL_NUM_ATTEMPTS_ETHERNET

LJM_LISTALL_NUM_ATTEMPTS_ETHERNET is a numerical readable-writable LJM library configuration which sets how many times LJM will retry device Ethernet discovery requests.

The constant LJM_LISTALL_NUM_ATTEMPTS_ETHERNETcan be used interchangeably with the string "LJM_LISTALL_NUM_ATTEMPTS_ETHERNET".

The default value is 2.

LJM_LISTALL_TIMEOUT_MS_WIFI

LJM_LISTALL_TIMEOUT_MS_WIFI is a numerical readable-writable LJM library configuration which sets how long in milliseconds LJM waits for a response to a WiFi connection discovery request.

The constant LJM_LISTALL_TIMEOUT_MS_WIFI can be used interchangeably with the string "LJM_LISTALL_TIMEOUT_MS_WIFI".

The default timeout is 1000 ms.

LJM_LISTALL_NUM_ATTEMPTS_WIFI

LJM_LISTALL_NUM_ATTEMPTS_WIFI is a numerical readable-writable LJM library configuration which sets how many times LJM will retry device WiFi discovery requests.

The constant LJM_LISTALL_NUM_ATTEMPTS_WIFIcan be used interchangeably with the string "LJM_LISTALL_NUM_ATTEMPTS_WIFI".

The default value is 2.

Open timeouts

These timeouts control how long LJM waits for a response at a given IP.

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

If you use "ANY" for the identifier to LJM_OpenS/LJM_Open, ListAll is called internally to find device connections. The ListAll timeouts will be used instead of the open timeouts given above.

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

Read LJM_ETHERNET_SEND_RECEIVE_TIMEOUT_MS, set LJM_ETHERNET_SEND_RECEIVE_TIMEOUT_MS, then read it again

C
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.

Related Errors

The below errors can sometimes occur if the send/receive timeout configuration is too low due to higher than expected connection latency. Increasing the send/receive timeout configurations can sometimes help avoid these errors, but they may also indicate a more general connection issue. We would recommend seeing our troubleshooting application notes for USB and Ethernet.

  • LJME_NO_RESPONSE_BYTES_RECEIVED

  • LJME_INCORRECT_NUM_RESPONSE_BYTES_RECEIVED

Subsections

JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.