Network Instances (Floating licenses)

<< Click to Display Table of Contents >>

Navigation:  WinLicense > License Restrictions >

Network Instances (Floating licenses)

You can generate licenses that are restricted to a specific number of instances over a local network, an intranet or virtual private network. The Network Instances feature works on protected EXE files and with some "restrictions" on DLLs (refer below).

 

Running an application with Network Instances

 

The Network Instances module works in Client-Server model. These are the basic steps to make the whole model work:

 

1.Your customer has to select one of his machines to determine which one will behave as server and send you the Hardware ID for that "server" machine. After that, you create a license with the option Network Instances checked (with the maximum number of instances) and also locking the license to the given (server) hardware ID.

 

2.The customer now runs the instance on the server. To do so he has to launch your protected application on the server as follows (suppose that the server IP is 192.168.1.22 and we want to work on port 5100)

         

MyApplication.exe    /wl_net_gui    /wl_net_server_ip 192.168.1.22 /wl_net_port 5100

 

oThe parameter /wl_net_gui launches a small window where the customer can see the number of clients (instances) that are running

 

oThe parameter /wl_net_server_ip should match the server IP address. This is because the server will act as a server and as the first client (first instance)

 

oThe parameter /wl_net_port specifies the port where the server and clients talk. The default value is 5000. If this parameter is not used it will use the default port (5000)

 

oIf the user doesn't want that the server instance will act as a client instance he can launch your protected application with the /wl_net_server_no_instance. Example:

 

MyApplication.exe    /wl_net_gui    /wl_net_server_no_instance

 

Notice that in this case the server IP is not required and your application will "not start". That is, your application will stay dormant in memory just waiting for clients to be connected.

 

3.Other computers on the network can now launch your protected application (while the instance in the server is running). To do so, clients have to launch your application with the following parameters (Suppose that the server IP is 192.168.1.22 and listening on port 5100)

 

MyApplication.exe      /wl_net_server_ip 192.168.1.22     /wl_net_port 5100

 

There are other extra parameters related with time when the server and clients communicate:

 

/wl_net_timeout   time_in_milliseconds

 

The "wl_net_timeout" should be increased for heavy loaded networks (or very long distant communication) to increase the internal timeout to give some extra time for packets to arrive. The default value is 4000 (4 seconds)

 

Using a Configuration File

 

You can create a configuration file instead of passing arguments via the command line. To do so, please, add a special option in the Advanced Options panel with the file name of your configuration file. Example:

 

OPTION_ADVANCED_NETWORK_FILE_SETTINGS_NAME=network_settings.ini

 

For the file name location, you can use special folder constants like: %APP_FOLDER%, %WIN_FOLDER%, %WINSYS_FOLDER%, %USER_DOCS%, %LOCAL_APP_DATA%, %USER_APP_DATA%, %COMMON_APP_DATA%, %TEMP_FOLDER%, %PUBLIC_DOCS%

 

For the file name you can use special constants like: %APP_NAME%, %SOFT_NAME%

 

Example:

OPTION_ADVANCED_NETWORK_FILE_SETTINGS_NAME=%USER_APP_DATA%\MySoftware\%APP_NAME%.ini

 

The configuration file is a text file like the following:

 

[NETWORK SETTINGS]

 

wl_net_server_no_instance=no

wl_net_server_ip=192.168.1.22

wl_net_port=5000

wl_net_timeout=2000

wl_net_gui=yes

 

Please, do not forget the "[NETWORK SETTINGS]" section name and all the keys and values in lowercase.

 

Possible Events (errors)

 

When a client instance is launched, WinLicense checks if a server instance is running and also count the number of clients running on the network. There are several events that can arise when working with floating licenses. All these events can be edit in the Customized Dialog panel or being handled by yourself (from a plugin DLL or from the WinLicense SDK)

 

MSG_ID_NETWORK_INSTANCES_NO_SERVER: This event occurs when a client is trying to launch your protected application but there is no a server instance running or it cannot communicate with the server instances (firewall blocking network access, network misconfiguration, etc).

 

MSG_ID_NETWORK_INSTANCES_NO_HW_LOCKED: As described above, when working with network instances, you have to also hardware lock your license (with the server hardware id). In case that a floating license is found and the license is not hardware locked, WinLicense will signal this event.

 

MSG_ID_NETWORK_INSTANCES_CANNOT_START_SERVER: This event occurs when the server instance cannot be started (probably due to firewall restrictions, network disconnected, etc). Notice that when this message appears, it means that the Hardware ID in the license is matching with the one on the server, the issue is probably coming from an incorrect IP address that has been passed as parameter. Please, make sure that you are passing the current IP address of the local machine (that is going to act as a server)

 

MSG_ID_NETWORK_INSTANCES_NO_MORE: This event occurs when a new client is launching your application but the maximum number of network instances has been reached.

 

 

WinLicense SDK when working with floating licenses

 

There are specific functions in the SDK to work with floating licenses:

 

WLRegNetInstancesMax:  Retrieves the maximum number of instances allowed in the current license.

 

WLRegNetInstancesGet: Retrieves the current number of instances running in a network.

 

 

Detect if a user is cheating

 

WinLicense allows a client to run in case that the maximum number of instances has not been reached. Once that the client instance starts, a customer might want to disconnect (or block) the network access to your running application, so the server will think that the current client was closed and there is again a free entry for a new client.

 

At the moment, the only way to detect if the running client instance has been "unplugged" from the network is by calling the function WLRegNetInstancesGet. If the function returns zero, that means the there is no connection with the server, so you can determined that the server was closed or the customer blocked the network access to your application, so you can do the actions that you consider.

 

 

Advanced Options

 

There are some specific advanced options that can be used when working with Network Instances. Please,  refer to the Advanced Options panel for more information.

 

 

Network Instances on protected DLLs

 

When applying network instances on a protected DLL, the protection cannot determine in boot time (before your DllMain is executed) the number of instances running. This is because the server/client instance is not fully registered until your DllMain is executed.

 

As the protection boot loader cannot determine the number of running clients until your DllMain is executed, you should call the function WLRegNetInstancesGet to know the number of running instances and compare it with the maximum number of network instances allowed (WLRegNetInstancesMax). You have to call those functions after your DllMain has been executed.