Network Protection:

Network Protection detects different instances of your application that are running simultaneously on a local network. Network protected applications transmit and receive discreet messages allowing you to count the number of instances of your application running on the network. Because your applications "communicate" with each other through the messages that are sent and received, you can confirm the authenticity of the applications on the network and disable applications if unauthorized instances are running.

 

The following is an example of the steps needed to enable the network protection in your application.

          Local Network

 

Step 1: Create a program

An example of relevant ProtectKit3 code (Visual Basic)

 

In the program's initialization code:

   Private Sub Form_Load()
      Dim Netword As String * 65
      Dim NetwordLen As Long
      Dim net As PROTECTKIT3NET
      Dim ret As Long
      net.szAppID = "12345678.VB6" & Chr$(0) 'Set a unique id for the application
      net.szMessage = Text1.Text & Chr$(0) 'The contents of the message to transmit (i.e. product serial number, etc.)
      net.lSendTime = Val(Text3.Text) ' The interval time (in seconds)
      net.hWndHandle = Me.hWnd 'The window handle
      ret = PK3NETInitialize(net, "Project1.exe", Netword, NetwordLen)
      ret = PK3NETStartNet
   End Sub

 

End the process:

   Private Sub Form_Unload(Cancel As Integer)
      PK3NETStopNet
   End Sub

 

Use an event to check for the application on other PCs:

   Private Sub Form_Resize()
      Dim ret As Long
      Dim msg As PROTECTKIT3NET_MSG
      'The receive the message
      ret = PK3NETGetMessage(msg)
      If ret <> False Then
         Text2.Text = Left(msg.szMessage, msg.lMessageLen) 'receive the transmitted message
         Text4.Text = Left(msg.szPcName, msg.lPcNameLen)
         Text5.Text = Left(msg.szMacAdr, msg.lMacAdrLen)
         Beep
      End If
   End Sub

For more details, please refer to the sample programs included with the ProtectKit3.

Step 2: Set the NetWord

(Use the Set Network Protection tool)

Setting the NetWord in your application:
You must do this whenever you rebuild your application

 

Be sure to keep the NetWord secret. Do not make it public!

Step 3: Attach a Digital Signature

If your application is to be digitally signed. This is the time to add the digital signature. If you are not digitally signing your application then proceed to step 4.

Step 4: Deploying your application

Include the necessary files with your application in your installer. For more details about deploying applications that use ProtectKit functionality, please refer to Deploying Applications

 

Some examples:

There are many ways that network protection can be used to protect your applications. In a simple example, network protection could keep multiple users from using a single license over a network. You could check to see if an instance of your application running on the network and if so prevent a second instance from starting up. It would certainly be possible to write code in your application to disable any application that attempts to run multiple instances. Or perhaps you want to allow up to a certain number of instances to run simultaneously but not to exceed that amount. That is easily accomplished as well.

Network protection, by using a common event, can transmit and receive information between instances of your application. This allows you to communicate detailed information between applications. One possible scenerio is illustrated below where unique product serial numbers are sent between applications and compared for authenticity.

One example of how to use the network protection on a network (LAN)

In the following case, we illustrate the situation where an application's serial number is used to check applications running on a network (LAN). If certain conditions are met, the application is allowed to run. If they are not met, the application is prevented from running and disabled. For this illustration we are assuming that each enduser of the application is provided with a unique serial number and that this serial number is saved in the registry when the application is installed.

 

 

*1 The Form Resize Event is common to all supported containers

     In C++Builder
          void __fastcall TForm1::FormResize(TObject *Sender)
     In Delphi
          procedure TForm1.FormResize(Sender: TObject);
     In VB
          Private Sub Form_Resize()
     In VC++
          void CProject1Dlg::OnSize(UINT nType, int cx, int cy)

 

*2 To set registry values

     Retrieving a registry value - PK3NETGetRegistryValue()
     Setting a registry value - PK3NETSetRegistryValue()
     Setting a registry key - PK3NETDeleteRegistryKey()

* For more details about DLL functions, refer to PkitNet32.dll/PkitNet64.dll