Setting timeout for ModbusTcpClient

146 views
Skip to first unread message

Sam Tymorek

unread,
Feb 18, 2016, 11:16:36 AM2/18/16
to pymodbus
Hi all,

I've noticed this question asked a few places but haven't found a definitive answer: how should I set a timeout for the ModbusTcpClient. I need a timeout of about 10 seconds. As is mentioned in this StackOverflow question, this can be set via the Defaults class:

from pymodbus.constants import Defaults
Defaults.Timeout = 10

I just want to confirm that that is the intended mechanism for setting a timeout. It works fine, but it feels a little strange dynamically setting a value in a file called constants! I see this is mentioned in this GitHub issue as well, so sorry if this is duplicative.

Thanks!

Sam

Galen Collins

unread,
Feb 18, 2016, 12:34:13 PM2/18/16
to pymodbus

As of now, that seems to be the only way to do it. If many people are doing this, I can shim it into the constructor and default the the constant if not set, however I hadn't seen anyone ask until recently.

Galen


--
You received this message because you are subscribed to the Google Groups "pymodbus" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pymodbus+u...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Sam Tymorek

unread,
Feb 18, 2016, 1:20:16 PM2/18/16
to pymodbus
Good to know, it's fine as is. Just wanted to confirm. Thanks!
Reply all
Reply to author
Forward
0 new messages