Skip to content

AsyncModbusTcpClient stops after ~30 seconds of inactivity #1187

Answered by janiversen
RoxanaDaniela asked this question in Q&A
Discussion options

You must be logged in to vote

I just ran your example:

(pymodbus) examples % python3 connect.py
Connecting..
Client connected: True
Input Register is: [17]
Waiting 30s..
End of Waiting
Client connected: True
Input Register is[17]
Client protocolModbusClientProtocol 127.0.0.1:502
End of Program

Which makes me wonder if the problem is that your device disconnects. Most devices have a timeout builtin to break an unused connection. From my experience the timeout is normally around 20-30 seconds.

Add logging and you will most likely see a message that the device closed the connection.

The keep-alive option of tcp/ip will NOT help here, since it is on application level, the device needs a modbus request within its builtin …

Replies: 4 comments 2 replies

Comment options

You must be logged in to vote
1 reply
@RoxanaDaniela
Comment options

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
1 reply
@RoxanaDaniela
Comment options

Answer selected by janiversen
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants