Access violation reading location when using zkemkeeper.dll

80 views Asked by At

I want to use zkemkeeper.dll in C# so I can work with a Biometric device, but I get an error when I want to connect the device related to plcommpro.dll, this is how i am trying to use it:

// Zkem.cs

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ZK
{
    internal class Zkem
    {
        public zkemkeeper.CZKEMClass device;
        private String ip;
        private int port;

        public Zkem(string ip, int port)
        {
            device = new zkemkeeper.CZKEMClass();
            this.ip = ip;
            this.port = port;
        }

        public bool Connect()
        {
            try
            {
                bool isConnected = device.Connect_Net(ip, port); // this is where the error occures
                if (isConnected)
                {
                    Console.WriteLine("Connected to device!");
                    return true;
                }
                else
                {
                    Console.WriteLine("Failed to connect to device.");
                    return false;
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine($"Error connecting to device: {ex.Message}");
                return false;
            }
        }

        public void Disconnect()
        {
            try
            {
                device.Disconnect();
                Console.WriteLine("Disconnected from device.");
            }
            catch (Exception ex)
            {
                Console.WriteLine($"Error disconnecting from device: {ex.Message}");
            }
        }
    }
}

this is the error:

Exception thrown at 0x0000024D69A4C715 (plcommpro.dll) in ZK.exe: 0xC0000005: Access violation reading location 0x0000000069DB1E73.
0

There are 0 answers