cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
jbronka
Flexera beginner

How to check if flex server is alive using API



Good morning

We have asking about possibility to checking of connection to Flex server without referencing to any Features.

The checking if Flex server is working is possible by "lc_checkout(...)" and "lc_test_conf(...)" API functions.
Unfortunately it is needed using of some Feature's name defined in server license file.

Our question:
Is there any other way to checking if Flex server is correctly working without using/referencing to Feature's name defined in server license file?
Please about information about it or confirmation that the reference to Feature's name is necessary.

Currently we use of the FlexNet Publisher 11.14.0.2 version.
We use protection with License File only (not Trusted Storage).
0 Kudos
1 Reply
dipujoseph
Flexera beginner

Re: How to check if flex server is alive using API

You can try using lc_heartbeat().

Syntax
int lc_heartbeat(
LM_HANDLE *job,
int *ret_num_reconnects,
int minutes);
Parameters
The lc_heartbeat function uses the following parameters:
Table 1-60 • lc_heartbeat Parameters
Parameter Description
job From lc_new_job.
ret_num_reconnects If null, this argument is ignored. If non-null, and the FlexEnabled application has just
successfully reconnected to the server, the return value will be 0 (success), and
ret_num_reconnects is set to the number of times the FlexEnabled application has
reconnected in the last minutes. If this is a large number, it may indicate attempted
theft.
minutes If 0, this argument is ignored. If non-zero, it is used to detect when a server is being
started and stopped many times in a short period, which can indicate attempted theft.
The reporting period is set with minutes.

Return
The following values are returned by lc_heartbeat:
Table 1-61 • lc_heartbeat Returns
Return Values Description
0 Success.
Any other value The license server is currently down. The number of failed attempts to reconnect to the
license server.

Discussion
Before calling lc_heartbeat, you must first turn off the automatic heartbeat mechanism before the first license checkout:
lc_set_attr(lm_job, LM_A_CHECK_INTERVAL, (LM_A_VAL_TYPE) -1);
lc_set_attr(lm_job, LM_A_RETRY_INTERVAL, (LM_A_VAL_TYPE) -1);
lc_heartbeat sends heartbeat messages to and receives acknowledgments from the license server. By default, these
activities are handled automatically by FlexNet Licensing via a separate, dedicated application thread. This function
provides manual control of heartbeat messages, thereby overriding the automatic mechanism.

0 Kudos