Versions Compared

Key

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

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.

Prototype

Code Block
languagecpp
LMX_STATUS LMX_Heartbeat

...


(
   LMX_HANDLE LmxHandle,

...


   const char *szFeatureName

...


);

Parameters

LmxHandle
[in/out] LM-X handle.

...

On failure (one or more local HostIDs are invalid or the license server is down or otherwise unreachable), this function returns an error code in the format described in Return codes.

If you call this function on a feature that does not exist, it will return LMX_FEATURE_NOT_FOUND.

...

There is no need to call this function for network licenses if you are using automatic heartbeats. (Note that automatic heartbeats are for network licenses only.)

...

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(h, "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;
}