Automatic heartbeats are for network licenses only, and are disabled by default. You can enable automatic heartbeats using the LMX_SetOption option LMX_OPT_AUTOMATIC_HEARTBEAT_ATTEMPTS.

The recommended setting for automatic heartbeats is between 30 seconds and 2 minutes. (The default interval is 2 minutes, which can be changed using the LMX_SetOption option LMX_OPT_AUTOMATIC_HEARTBEAT_INTERVAL.)

Automatic heartbeats start an extra thread that calls the license server on behalf of the client at the specified intervals. If the license server fully restarts between heartbeats from an application, automatic heartbeats will recognize that the server has restarted and will attempt to re-checkout its required license(s).

Until the failed heartbeats counter value equals LMX_OPT_AUTOMATIC_HEARTBEAT_ATTEMPTS, the client will only attempt to reconnect to the server from which the feature was originally checked out. Only after the counter value is reached will the client attempt to connect to other servers.

If the checkout is not possible (for example, the remainder of available licenses have been checked out in the meantime), this information will be relayed to the application, which will behave in the manner specified. If, for example, five heartbeats in a row fail, automatic heartbeats will call an exit() function on behalf of the application and print error information to the screen. This behavior can be overridden with the HEARTBEAT_EXIT_FUNCTION callback, described in Heartbeats.

Using a counter to prevent license overuse

When the server is restarted it takes a few minutes for all clients to reconnect. Particularly for applications that run for short periods of time, license overuse may occur if the license server is stopped and restarted frequently.

To prevent intentional license overuse, you can implement a custom-coded counter. Using LMX_OPT_AUTOMATIC_HEARTBEAT_ATTEMPTS together with  LMX_OPT_AUTOMATIC_HEARTBEAT_INTERVAL, you can detect broken network connections. By implementing a custom counter in addition to these API calls, you can track the number of times the license server goes down and comes back up during a specified interval, and stop the application if a particular frequency is exceeded. For example, the counter could limit the number of times the license server goes down to 10 times per hour before making the application unavailable.

When considering implementing such a counter, be aware that an unstable network can cause the connection to the server to go down often, which will cause the application to stop. The need to implement a counter should be based on the reliability of the network and your trust in your customer.