ZKteco SDK for VB.net fail after some time

861 Views Asked by At

Hope not cause inconvenience. I 'm developing a very simple app as part of my educational project, using the ZKteco SDK 6.3.1.37 in VB.net, and the SCR100 device in Windows 10...

Using "connect_net" I have no trouble, the connection to device is successful.

The problem is when I use "OnHIDNum", punching a RFID card and trigger an event. It works for a few minutes and after that it does not work anymore. Even when I restart My app, I tried another PC, and the same thing, I have connection to device and the OnHIDNum event works again a few minutes, and suddenly no more....

I could use a timer to disconnect and connect every so often to restart sdk, but some records might be lost at runtime. If anyone can help me, I have no idea what's going on, VB.net compatibility, the SDK, code, or device..... Thanks a lot...

Here is the VB.net code:

Dim sIp As String = “192.168.1.201”
Dim iPort As Integer = 4370
Dim iMachineNumber As Integer = 1
Dim count As Integer = 0
 
Private Sub Connect_toDevice(sIp As String, iPort As Integer, iMachineNumber As Integer)
 
        Dim bIsConnected As Boolean = False
        'the serial number of the device.After connecting the device ,this value will be changed.
        Dim idwErrorCode As Integer = 0
 
 
        bIsConnected = axCZKEM1.Connect_Net(sIp, iPort)
        If bIsConnected = True Then
 
            iMachineNumber = 1 'In fact,when you are using the tcp/ip communication,this parameter will be ignored,that is any integer will all right.Here we use 1.
            axCZKEM1.RegEvent(iMachineNumber, 65535) 'Here you can register the realtime events that you want to be triggered(the parameters 65535 means registering all)
            AddHandler axCZKEM1.OnHIDNum, AddressOf AxCZKEM1_OnHIDNum
        Else
            axCZKEM1.GetLastError(idwErrorCode)
            MsgBox(“Err: ” & idwErrorCode, MsgBoxStyle.Exclamation, title_msg)
        End If
    End Sub
 
 
Private Sub AxCZKEM1_OnHIDNum(ByVal iCardNumber As Integer)
        count += 1
 
        'I have result in my dataGridView for a few minutes, and no more
        Me.myDataGridView.Rows.Add(count, iCardNumber, DateAndTime.Now)   
 
        'the same thing when I use an alert MsgBox
        MsgBox("card number: " + iCardNumber, MsgBoxStyle.Information, "title")
End Sub
1

There are 1 best solutions below

1
On

Because this SDK has some strange behaviors and their support doesn’t respond to any request.

My issue was to download the in/out logs for employees but it got the same error as yours, I worked around as below:

Download all logs to a Datagridview

I made a timer to download all logs every 5 minutes to a temp DGV then compare the two DGVs if there are new rows.

This way of work is really (disgusting) because it requires a lot of lines to write and also could not work with you if you have a large amount of logs in your device but I couldn’t find another way work around their bugs.

However, here’s a link for a sample code of how I connect the device and download the logs, please note: this code doesn’t resolve your issue, it’s just to show you a correct way to download logs, hope will help you.