Using EID Files

<< Click to Display Table of Contents >>

 

Using EID Files

When selecting the R/W EntryID File (.EID) option on the Reports tab, this Driver generates a file for each ID with an .eid extension, containing the last received EntryIDs for each Report in use. This file is generated in at least two seconds after receiving a Report message and also before shutting down an application. This file is generated on the same directory of cache files (.LD).

During this Driver's initialization, the application waits for the availability of this file to proceed, to retrieve the values of the processed EntryIDs until this operation is interrupted. In a redundant system, a user-created application must be responsible for syncing this file between main and Standby machines.

The next example, which must be executed cyclically, copies EntryID files among redundant servers. As this Driver is loaded by the IOServer module, which executes on the System account, the example code uses the psExec (SysInternals) application to elevate privileges of a Windows user, by executing a batch (.bat) file that specifies a user and a password.

 

NOTE

For more information about the psExec application, please check article PsExec v2.2 on Microsoft Developer Network.

 

Sub MyTimer_OnPreset()
  Set objWScript = CreateObject("WScript.Network")
  strServer = objWScript.ComputerName
  Set sw = CreateObject("WSCript.shell")
  Set fso = CreateObject("Scripting.FileSystemObject")
  Set folder = fso.GetFolder("C:\MyAppDir\MyEntryIdDir")
  'Loads .eid files
  For Each file In folder.Files
    GetAnExtension = fso.GetExtensionName(file.path)
    If GetAnExtension = "EID" then
      'Copies files
      fso.CopyFile file.path, "C:\MyAppDir\MyEntryIdDir\EID\"
    End If
  Next
  If strServer = "Server2" Then
    sw.run "C:\MyAppDir\Bat\psExec.exe -i 0 -u UserAccount -p Domain@password cmd /c C:\MyAppDir\Bat\toServer1.bat", 0
  End If
  If strServer = "Server1" Then
    sw.run "C:\MyAppDir\Bat\psExec.exe -i 0 -u UserAccount -p Domain@password cmd /c C:\MyAppDir\Bat\toServer2.bat", 0
  End If
End Sub

 

Content of toServer1.bat file:

copy C:\MyAppDir\EntryId\EID, \\Server1\EntryID

 

Content of toServer2.bat file:

copy C:\MyAppDir\EntryId\EID, \\Server2\EntryID

Was this page useful?