For local features, the LMX_Heartbeat function checks whether HostIDs are valid. Note that devices such as dongles can be removed during runtime.
For network features, in addition to checking HostIDs, the LMX_Heartbeat function checks whether the network connection to the license server is working.
...
If the license is lost, LMX_Heartbeat will return LMX_HEARTBEAT_LOST_LICENSE. In the case of a lost license, the client must perform a checkin and then a checkout to continue using the license.
Example
After a checkin of the feature "f2", the LMX_Heartbeat function checks whether "f2" connection to the license server is working; for local licenses, LMX_Heartbeat checks whether HostIDs are still valid, as shown below.
Code Block | ||
---|---|---|
| ||
#include <lmx.h>
#include <stdio.h>
LMX_HANDLE h;
int main() {
exit_on_error(LMX_Init(&h));
exit_on_error(LMX_Checkout(h, "f2", 1, 0, 1));
exit_on_error(LMX_Heartbeat(h, "f2"));
return 0;
} |
The following example shows how to set an automatic heartbeat with the heartbeat frequency set for 60 seconds.
Code Block | ||
---|---|---|
| ||
#include <lmx.h> #include <stdio.h> LMX_HANDLE h; int main() { exit_on_error(LMX_Init(&h)); exit_on_error(LMX_SetOption(h, LMX_OPT_AUTOMATIC_HEARTBEAT_ATTEMPTS, (LMX_OPTION) 1)); exit_on_error(LMX_SetOption(h, LMX_OPT_AUTOMATIC_HEARTBEAT_INTERVAL, (LMX_OPTION) 60)); return 0; } |