bulentv / js_zklib

Attendance Machine Library for NodeJS with a connection to the network using the UDP protocol and port 4370
GNU General Public License v2.0
56 stars 46 forks source link

c3-200 not working here #54

Open iojancode opened 5 years ago

iojancode commented 5 years ago

Hi, im having troubles connecting, any help would be appreciated

this is the test

var ZKLib = require("zklib");

ZK = new ZKLib({
  ip: '192.168.86.21',
  port: 4370,
  inport: 5200,
  timeout: 5000,
  connectionType: 'tcp',
});

    // connect to access control device
    ZK.connect( function() {

      // read the time info from th device
      ZK.getTime( function(err, t) {
        console.log("Device clock's time is " + t.toString());

        // disconnect from the device
        ZK.disconnect();
      });
    });

this is the failure

events.js:160
      throw er; // Unhandled 'error' event
      ^

Error: write after end
    at writeAfterEnd (_stream_writable.js:195:12)
    at Socket.Writable.write (_stream_writable.js:242:5)
    at Socket.write (net.js:669:40)
    at ZKLib.writeTcpSocket (/Users/johann/node_modules/zklib/zklib/zklib.js:235:12)
    at ZKLib.send (/Users/johann/node_modules/zklib/zklib/zklib.js:181:12)
    at ZKLib.executeCmd (/Users/johann/node_modules/zklib/zklib/zklib.js:101:10)
    at ZKLib.getTime (/Users/johann/node_modules/zklib/zklib/zktime.js:13:10)
    at /Users/johann/Temp/zkteco/js_zklib/mytest.js:15:10
    at createSocket.err (/Users/johann/node_modules/zklib/zklib/zkconnect.js:13:9)
    at Socket.socket.once.err (/Users/johann/node_modules/zklib/zklib/zklib.js:151:7)
toxaq commented 4 years ago

Are C3's known to work with this library? The protocol on the wire looks entirely different but perhaps that's a firmware change...

caobo171 commented 4 years ago

I don't think so, this error indicate that tcp connection is not the right connectiontype ( may be is udp is true ) or some device also connect to this device then you can't connect to it