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

Timeout error #150

Closed
jvguerrero opened this issue Oct 18, 2022 · 14 comments
Closed

Timeout error #150

jvguerrero opened this issue Oct 18, 2022 · 14 comments

Comments

@jvguerrero
Copy link

Hi sir, i hope can you help me. I'm triying to conect a device with tcp procotol but during the process terminate itself with timeout error

I track the error in base.py file and it has produced in self.__tcp_data_recv = self.__sock.recv(response_size + 8)

The device is ZMM200_TFT

@jvguerrero
Copy link
Author

image

@kurenai-ryu
Copy link
Collaborator

timeout means that the device didn't answer to the tcp command.

  1. confirm a device response (ping)
  2. test with zkteco software (capture wireshark pcap file)
  3. disable communication password
  4. test with UDP communication
  5. try with another library (pyzatt)

reopen if you have more information (pcap file to analize, maybe it uses different commands)

@jvguerrero
Copy link
Author

Sir, the ping its okay and i've tried udp connection but it fail too

I attached 2 files, the zksoftware.zip is the trace using zk software with succesful connection and the pythonlib.zip is the timeout error.

There is the config i've used
image

zk software.zip
pythonlib.zip

@kurenai-ryu
Copy link
Collaborator

ok, what I see from your zk software PCAP is that the connect command has 2 extra bytes, 0x6c 0x00, I haven't found this behavior before,
but anyway, I made a test branch, (MR ) which you can use to test with a connection line like:

conn = zk.connect(b'\x6c\x00')

also don't forget that there's a comm password, so don't forget to add a password to the Instantiation line ZK('192.168.70.35', port=4370, password='YOURPASSCODE')

@kurenai-ryu
Copy link
Collaborator

ok, after further checking, it seems it sends a lot of times that 0x6c 0x00 so please check by adding the b'\x6c\x00' in connect is enough or it's needed in other 'empty' commands.

@jvguerrero
Copy link
Author

i've updated base.py and used the new connect but it throw me this error TCP packet invalid
i've take screenshot before the error
Sin título

@kurenai-ryu
Copy link
Collaborator

It seems that your device also sends an empty packet, I'm adding a retry in the MR

if this doesn't work, I can only say that the firmware of your device is not supported by this library.

@jvguerrero
Copy link
Author

Sir, it doesn't work and continue throw me timeout error. Anyways i really appreciate your time.

I'll give you some information of the my device if u need for some reason or to the future.

Firmware version is 8.0.4.2-5996-01 and when i connect from telnet it show me the next data

image

@auriga-ajaytak
Copy link

@jvguerrero
Did you find the solution? I am facing the same issue.

@kurenai-ryu
Can you please help me with the same issue? Below are my device details.

Platform Information : ZMM200_TFT
MCU Version : 14
Firmware Version : Ver 8.0.4.2-20180713
Bio Service : Ver 2.1.12-20180503
Push Service : Ver 2.0.34-20180611
System Version : Ver 17.8.9-20161214

@jvguerrero
Copy link
Author

Hi sir, yes i found a solution but finally i used pure python and another library from Oficial ZKTeco 'cause this library use different commands. Btw i haven't tried realtime data but i can access to the general log data from users, and add/modify/delete user templates. Write me joel.ldp2015@gmail.com if want code 'cause idk if github have dm.

Anyways thanks kurenai for your support, this library works fine for me with another device.

@ndd-odoo
Copy link

Oficial ZKTeco

Hi @jvguerrero could you please give me the name of the library, i think iam facing the same issue here. I would very appreciated, thank you

@core-burner
Copy link

This had nothing to do with the library.
ZKTEco devices typically do not respond to TCP on 4370.
To use TCP, port#4368 needs to be used and this could be pointed out in code.
@kurenai-ryu

@ndd-odoo
Copy link

This had nothing to do with the library. ZKTEco devices typically do not respond to TCP on 4370. To use TCP, port#4368 needs to be used and this could be pointed out in code. @kurenai-ryu

This is wrong, the port is base on machine configuration too

@core-burner
Copy link

core-burner commented Aug 19, 2024

This had nothing to do with the library. ZKTEco devices typically do not respond to TCP on 4370. To use TCP, port#4368 needs to be used and this could be pointed out in code. @kurenai-ryu

This is wrong, the port is base on machine configuration too

sm
I insist. Most Zkteco reader SDK(all that I have seen up to firmware 6.3.x.x) typically connect TCP over 4368, and will RST the SYN if you attempt to do so from 4370. UDP works over 4370. An attempt of TCP will also induce a delay in response so connecting over 4370, making force_udp preferable for faster operation. TCP doesn't function reliably in any ZKT library, but is is supported by additional functionality in the C# etc SDKs where they are used to create COM objects.
Screenshot shows the packets of two separate attempts on a random reader that are performed over the two different ports. TCP requests were made over 4370 which fell back to UDP after 4 attempts where 4368 would connect instantly.
On the other hand, you won't be able to connect at 4368 over UDP.
Regardless TCP on this kind of webserver is very much problematic and ultimately distinction should be made in such a wrapper.
Naturally you can do many configurations on many different devices that are not so common. But I have not seen any code contradicting this.

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

5 participants