【问题标题】:Error Code -201 when using ZKemKeeper.DLL使用 ZKemKeeper.DLL 时出现错误代码 -201
【发布时间】:2017-08-03 06:07:59
【问题描述】:

我正在使用 ZKemKeeper.DLL 创建 C# WinForm 以从生物识别设备中获取数据。但是当我尝试将我的应用程序连接到设备时,它总是给出错误代码 -201

知道是什么原因造成的吗?我已经阅读了 ZKemKeeper.DLL 的指南文档,但它没有将 -201 列为错误代码。任何帮助将非常感激。谢谢。

private void btnConnect_Click(object sender, EventArgs e)
        {
            try
            {
                IsConnected = TimeKeeper.Connect_Net(txtIP.Text, 4370);
                if (IsConnected == true)
                {
                    MessageBox.Show("Device Connected Successfully.");
                }
                else
                {
                    TimeKeeper.GetLastError(ref ErrorCode);
                    MessageBox.Show("Device Not Found. Error Code : " + ErrorCode.ToString(), "Error");
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message.ToString());
            }
        }

【问题讨论】:

  • 您是否尝试过在端口 4370 中 telnet 设备?
  • 还检查设备是否存在于给定地址上。
  • 检查你项目的目标cpu,并尝试将其更改为x86
  • @Zalomon & UmairAnwaar 我可以成功 ping 设备的 IP,并且独立程序可以使用相同的 IP 和端口连接到设备,但在我的它不能,它只会给出错误代码 -201。
  • @Pikod 会试试的,谢谢!

标签: c# winforms biometrics


【解决方案1】:
protected void btnConnect_Click(object sender, EventArgs e)
        {
            try
            {
                //this.Cursor = Cursors.WaitCursor;
                //ShowStatusBar(string.Empty, true);

            if (IsDeviceConnected)
            {
                IsDeviceConnected = false;
                //this.Cursor = Cursors.Default;

                return;
            }

            string ipAddress = txtIPAddress.Text.Trim();
            string port = txtPort.Text.Trim();
            if (ipAddress == string.Empty || port == string.Empty)
                throw new Exception("The Device IP Address and Port is mandotory !!");

            int portNumber = 4370;
            if (!int.TryParse(port, out portNumber))
                throw new Exception("Not a valid port number");

            bool isValidIpA = UniversalStatic.ValidateIP(ipAddress);
            if (!isValidIpA)
                throw new Exception("The Device IP is invalid !!");

            isValidIpA = UniversalStatic.PingTheDevice(ipAddress);
            if (!isValidIpA)
                throw new Exception("The device at " + ipAddress + ":" + port + " did not respond!!");

            objZkeeper = new ZkemClient(RaiseDeviceEvent);
            IsDeviceConnected = objZkeeper.Connect_Net(ipAddress, portNumber);

            if (IsDeviceConnected)
            {
                string deviceInfo = manipulator.FetchDeviceInfo(objZkeeper, int.Parse(txtMachineNumber.Text.Trim()));
                //lblDeviceInfo.Text = deviceInfo;

                lblMessage.Text = deviceInfo + "is Connected";
            }

        }
        catch (Exception ex)
        {
            throw(ex);
        }
        //this.Cursor = Cursors.Default;
    }

【讨论】:

  • 感谢您提供此代码 sn-p,它可能会提供一些有限的短期帮助。一个正确的解释would greatly improve 其长期价值,通过展示为什么这是解决问题的好方法,并将使其对未来有其他类似问题的读者更有用。请edit您的回答添加一些解释,包括您所做的假设。
  • 有没有办法自动将设备中的日志下载到软件中,而无需手动点击下载按钮?
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2011-12-20
  • 2013-09-28
  • 1970-01-01
  • 2014-02-17
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多