cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
jbronka
Level 2

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
(2) Replies
dipujoseph
Level 3

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
charleskaren
Level 2

Hi @jbronka 

If you want to check if a FlexNet Publisher (FNP) server is alive and correctly working without referencing the Feature's name defined in the flex server  license file, you have a few options. Keep in mind that FNP may not provide a standardized API for directly checking the server's status, so these methods might vary based on your specific setup and environment.

  1. Ping the Server: You can try pinging the server's hostname or IP address. This won't guarantee that the FNP service is functioning correctly, but it will confirm whether the server is reachable. However, just because the server is reachable doesn't mean the licensing service is functioning as expected.

  2. Port Check: FNP typically uses specific ports for communication. You can check if these ports are open and responding. The default port is 27000. You can use a tool like Telnet or a network port scanning tool to check if the port is open and responsive.

    If the connection is successful, the server is at least listening on the specified port. However, this doesn't guarantee that the licensing service is fully operational.

  3. Web Services: If your FNP setup includes the Web Services feature, you might be able to use the web services endpoints to query the flex server status. FNP provides SOAP and REST-based web services that can provide information about licenses, usage, and possibly server status.

    Check your FNP documentation for details about the available web services and how to interact with them.

  4. License Usage Queries: FNP servers often provide a way to query the current license usage. This doesn't directly check if the server is alive, but if you can retrieve license usage data, it indicates that the server is operational to some extent.

  5. Monitoring Tools: Consider using third-party monitoring tools designed for license servers. These tools can provide more advanced monitoring and alerting capabilities, allowing you to receive notifications if the server goes down or encounters issues.