Connect_Net

Definition

Usage

Connect to the device via the IP address and set up a network connection with the device.\

Parameter

IP address of the device

Port number used for connecting to the device. The default value is 4370.

Return Value

Return True if it is successful, or return False.

Related Function

Disconnect, Connect_Com, Connect_USB

 

Ejemplo

C#

                        //Create Standalone SDK class dynamicly.
    zkemkeeper.CZKEMClass axCZKEM1 = new zkemkeeper.CZKEMClass();
                        //the boolean value identifies whether the device is connected
                        bool bIsConnected = false;
                        //the serial number of the device.After connecting the device ,this value will be changed.
                        int iMachineNumber = 1;
                        int idwErrorCode = 0;
                        // The string value identifies the IP the device.
                        string sIP = "10.0.0.43";
                        // The Int value identifies the Port the device.
                        string sPort = "4370";
    bIsConnected = axCZKEM1.Connect_Net(sIP, Convert.ToInt32(sPort));
                        if (bIsConnected == true)
    {
        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)
    }
                        else
    {
        axCZKEM1.GetLastError(ref idwErrorCode);
        MessageBox.Show("Unable to connect the device,ErrorCode=" + idwErrorCode.ToString(), "Error");
    }

VB

                        'Create Standalone SDK class dynamicly.
                        Dim axCZKEM1 As New zkemkeeper.CZKEM
                        Dim bIsConnected = False 'the boolean value identifies whether the device is connected
                        Dim iMachineNumber As Integer 'the serial number of the device.After connecting the device ,this value will be changed.
                        Dim idwErrorCode As Integer
                        Dim sIP As String
                        Dim sPort As Integer
    sIP = "10.0.0.43"
    sPort = 4370
    bIsConnected = axCZKEM1.Connect_Net(sIP, sPort)
                        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)
                        Else
    axCZKEM1.GetLastError(idwErrorCode)
    MsgBox("Unable to connect the device,ErrorCode=" & idwErrorCode, MsgBoxStyle.Exclamation, "Error")
                        End If