Open topic with navigation
Project name: NetFloat
This type of network restriction allows you to regulate the number of concurrent users executing the application at one time. You decide the maximum number of workstations using your application simultaneously by setting the LAN Limit field in the License File.
Optional Copy Protection
It is also possible to lock the application to the network server being used to avoid illegal copying. In most cases, the License File has only one entry with the Computer ID Number generated on the information derived from the server information using algorithm COMPNO_NETNAME for CPAlgorithm and the server drive or UNC path for CPAlgorithmDrive. If your software may be installed on a Peer-to-Peer network such as Novell Lite, Lantastic, or Windows Networking, the method Redir must be used to determine if the software is currently running from the peer server or from across a network. When executing the CPCheck method, switch the algorithm used in CPAlgorithm depending on from which hardware you are running. Use computer number from COMPNO_HDSERIAL, COMPNO_WINPRODID, etc. for server. Use the computer number from COMPNO_NETNAME for all workstations.
Network Semaphore Files
Using an exclusive file locking technique, Network Semaphore Files can be used to accurately count the number of current users of an application. You specify the path and file prefix to be used for the semaphore files. This path must be in a common network directory that is read/write accessible to all network clients. One semaphore file is created and locked per workstation using the path and prefix you specified, while appending a sequential number. The path is specified in the property SemPath, the prefix is specified in the property SemPrefix.
The NetFloat project demonstrates:
Opening a License File
Determining if application is running across the network using the Redir method
Generating a Computer ID Number
Checking for Network Copy Protection validation
Counting simultaneous users using Floating Network Licensing
Disabling menu options when license is not valid
Remotely changing the number of allowed users
Feel free to browse, copy the source code and paste it into your own application. To learn how to implement Network Floating Licensing in your own application from scratch, refer to the topic Implementing Floating Network Licensing.
Modules/forms/files in project
frmMain – form that simulates your application and hosts the PLUS control. This form has several menu options that simply display message boxes. When the form is loaded, the necessary properties are set so that it can open the License File and identify the location of the network semaphore files. The StatusChanged event fires after opening. This event determines the mode of the application and takes necessary actions such as enabling or disabling menu options and displaying messages. Before the application displays the main form, the copy protection test is run. If the test fails, a Message Box appears informing the user that this is an unlicensed copy that needs to be registered before continuing. If the copy protection test passes but the number of allowed users has been reached, a different message is displayed indicating that all licenses have been used. The File / Enter Activation Code menu option displays the Trigger Code screen.
sample.ini – license file that contains the copy protection and network user information. This sample application requires that the License File exist in the application directory. One is provided in this directory set for two users.
Select Product Definition in LFEdit
Run LFEdit from Start / Programs / SoftwareKey Licensing System / PLUS. If using an evaluation copy, change the product name in the toolbar combo box to NetFloat. If this is not in your list, go to Tools / Options and select Use Sample Definitions. When done experimenting with the sample applications, be sure to change this setting back to Use My Product Definitions.
Create a License File in LFEdit
In LFEdit, click the New button on the toolbar. Click on the Expiration Fields Tab. Change the value of Users Allowed to the number of simultaneous users that this copy should allow. Save the License File in the directory where your application is stored. The proper value will be written to the License File. It is also possible to ship the application with all modules disabled and use Trigger Codes to enable the modules that the customer purchases.
Run Your Application
The first time your application is executed on the client's computer, it will not have been unlocked. Therefore, it will fail the copy protection test and the "This application must be activated" message box will appear.
Activate the Application Using EZ Trigger™
Click on the File / Enter Activation Code menu option added to display the Trigger Code dialog. Write down the two numbers on the form. These two numbers are what your customer will give you by phone, fax, or e-mail. Run LFEdit. With the correct Product Definition selected in the toolbar, click on the Trigger Codes button (lock) on the toolbar. Select Code 27 and click Select. Enter the two numbers previously written down and click Generate. Write this number down. This is the unlock code that will be given to the customer. Minimize LFEdit and enter this code into the application. You should see the "Activation Complete" message appear. If you did not pre-create a License File with the LAN users allowed, you will also need to give Code 33 to set the number of allowed users.
When shipping your software to customers, you can preset the Users Allowed field in the License File with the number of users they have purchased or simply ship with 1 and use a Trigger Code to change the value once they have the software installed. Trigger Codes 34 and 35 also apply to network licensing. If you run this application on a peer-to-peer network, you will need to give Code 27 once on the server and once from one of the workstations. If for some reason your application does not exit properly, rebooting the machine should free up the license by letting the network close the exclusive lock on the file. On older network operating systems, it may be necessary for the station that exited improperly to run the application and exit safely for the license to be freed up.
For all sample applications, the License File password used is password, the Trigger Code Event ID seed (RegKey1) is 400 and the Trigger Code Event Data seed (RegKey2) is 123.