Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Returning false while connecting bio metric machine using C#

Tags:

c#

biometrics

I want to connect bio metric machine using C#. I am using zkemkeeper dll for connecting with machine

I have used connect_net method to connect with ip address and port

public partial class Form1 : Form
{
    public zkemkeeper.CZKEM machineObj = new zkemkeeper.CZKEM();
    public Form1()
    {
        InitializeComponent();
    }

    private void button1_Click(object sender, EventArgs e)
    {
        bool status = false;        
        status = machineObj.Connect_Net("10.10.32.162", 5005);
        if (status)
        {
            MessageBox.Show("Connect to machine successfully");
        }
    }
}

Now this machineObj.Connect_Net always return false what is the reason behind this any one have solution?

error code is -2

like image 267
Chitra Nandpal Avatar asked Jul 23 '18 05:07

Chitra Nandpal


1 Answers

there was a long time ago when I dealt with it, I found some useful tips on code project in this post:

1) The connection is denied by firewall settings (on your system or a router): Check the firewall logs.

2) The device has a white or black list configuration that does not allow connections from your system's IP address: Check the configuration of the device and the log files (if such exist).

3) The packages are not routed when your system is not in the same subnet as the device: Configure port forwarding on the device's next gateway.

if your device as a white or blacklist configuration, you better start digging into your logs and device configuration.

Meanwhile start exploring your firewall as well, if there is any, to make sure you are not being blocked from connecting to the device.

edit: I saw your comment so this might be the cause of your issue.

the most common reason however, is the third because it is easier to miss, it is unnoticeable and does not catch the eye. Make sure your system is in the same subnet as the device. If not, configure your port forwarding on the device.

like image 169
Barr J Avatar answered Oct 13 '22 01:10

Barr J