Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

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
languagecpp
#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(LmxHandle, "f2"));
  return 0;
}

The following example shows how to set an automatic heartbeat with the heartbeat frequency set for 60 seconds.

Code Block
languagecpp
#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;
}