首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >使用ZKemKeeper.DLL时的错误代码-201

使用ZKemKeeper.DLL时的错误代码-201
EN

Stack Overflow用户
提问于 2017-03-13 17:16:04
回答 1查看 2K关注 0票数 2

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

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

代码语言:javascript
复制
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());
            }
        }

EN

回答 1

Stack Overflow用户

发布于 2018-01-08 23:26:10

代码语言:javascript
复制
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;
    }
票数 -1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/42760014

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档