Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using TCP on port 80 #25

Closed
riadh2002 opened this issue Jun 19, 2020 · 5 comments
Closed

Using TCP on port 80 #25

riadh2002 opened this issue Jun 19, 2020 · 5 comments

Comments

@riadh2002
Copy link

riadh2002 commented Jun 19, 2020

If I try to set the port to TCP80 instead of UDP4370
let zkInstance = new ZKLib(192.168.1.202, 80, 10000, 4000);

I get the follwing error:

ZKError {
err: Error: TIMEOUT_ON_WRITING_MESSAGE
at Timeout. (nodejs\node_modules\node-zklib\zklibtcp.js:100:22)
at listOnTimeout (internal/timers.js:549:17)
at processTimers (internal/timers.js:492:7),
ip: '192.168.1.202',
command: 'TCP CONNECT'
}

is there any other considerations to take into account to use TCP instead of UDP?

the reason of using TCP is to get more user info (password, cardID) which are not available through UDP

thanks

@caobo171
Copy link
Owner

Oh, it depends on your device, some device use UDP, some use TCP, I covered it in my code, but I didn't see a device use port 80 before, it usually uses port 4370 both for TCP or UDP

@riadh2002
Copy link
Author

riadh2002 commented Jun 21, 2020

Thanks,

it seems the TCP error is also thrown if a pointing device is outside the local network example: ip=device.ddns.net that resolves to 80.90.100.110, even-though both TCP80 and UDP4370 ports are open and the device is accessible using ZK software

ZKError {
err: Error: connect ETIMEDOUT 80.90.100.110:4370
at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1141:16) {
errno: 'ETIMEDOUT',
code: 'ETIMEDOUT',
syscall: 'connect',
address: '80.90.100.110',
port: 4370
},
ip: 'device.ddns.net',
command: 'TCP CONNECT'
}

I wonder if there is a port problem here?

@riadh2002
Copy link
Author

riadh2002 commented Jun 21, 2020

Hello again,

OK using your comment about port 4370 as UDP and TCP, I opened port 4370 on TCP and tried and it worked!!!

So for this to work, port 4370 must be open on both TCP and UDP and the program chooses which one to use.

But one issue is when the program chooses TCP, the getUsers will not return the password and Card Number?

thank you

@caobo171
Copy link
Owner

Thanks,

it seems the TCP error is also thrown if a pointing device is outside the local network example: ip=device.ddns.net that resolves to 80.90.100.110, even-though both TCP80 and UDP4370 ports are open and the device is accessible using ZK software

ZKError {
err: Error: connect ETIMEDOUT 80.90.100.110:4370
at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1141:16) {
errno: 'ETIMEDOUT',
code: 'ETIMEDOUT',
syscall: 'connect',
address: '80.90.100.110',
port: 4370
},
ip: 'device.ddns.net',
command: 'TCP CONNECT'
}

I wonder if there is a port problem here?

I think it's my lib's problem, but I can't fix this now with my resource, all my test devices are used in my company so it's hard for me to request them open another port

@caobo171
Copy link
Owner

Hello again,

OK using your comment about port 4370 as UDP and TCP, I opened port 4370 on TCP and tried and it worked!!!

So for this to work, port 4370 must be open on both TCP and UDP and the program chooses which one to use.

But one issue is when the program chooses TCP, the getUsers will not return the password and Card Number?

thank you

glad to hear that, the missing properties is caused by lacking document, I don't know how to extract it :(

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants