FreeOpcUa / python-opcua

LGPL Pure Python OPC-UA Client and Server
http://freeopcua.github.io/
GNU Lesser General Public License v3.0
1.36k stars 658 forks source link

Mixing seconds and milliseconds in client #541

Open martenjacobs opened 6 years ago

martenjacobs commented 6 years ago

In client/ua_client.py, there are some issues with milliseconds and seconds being mixed up. As I understand it, OPC-UA's TimeoutHint, RequestedSessionTimeout and RevisedSessionTimeout (maybe more) parameters are all expressed in milliseconds, while Python's concurrent.futures.Future.result method expects seconds.

This means UASocketClient.send_request will send a request with a TimeoutHint of one second (when using default parameters) to the server, and then wait for up to 1000 seconds for a response.

I'd suggest making sure every parameter is expressed in seconds (as this is more widely adopted in Python), and only converting to milliseconds where needed at the last moment

oroulet commented 6 years ago

Thanks for the bug report! You are right. Feel free to send a pr