Post by winki on ModbusFB ClientRequest: never recovers after a single ReplyTimeout (requires full download)
CODESYS Forge
talk
(Post)
Library: ModbusFB (CODESYS Modbus package) IDE / Runtime: CODESYS V3.5 SP___ / Control runtime ___ Target: ___ (e.g. gateway, Linux ARM64 / Debian) Slave: Modbus TCP inverter Summary I poll a Modbus TCP slave with a permanent connection: one ClientTCP (kept connected, xConnect:=TRUE) and one ClientRequestReadHoldingRegisters, triggered cyclically. Everything works fine after a fresh application download. But as soon as one single ReplyTimeout occurs (slave temporarily not answering), the request never recovers. It stays stuck and no further messages are sent, even though the TCP connection is still reported as alive. Only a full application download brings it back β an online change or a runtime reset is not enough / not what I want in production. State observed when stuck So the connection is alive, the request finished in ReplyTimeout, the FB is back to _state = None, but udiNumMsgSent no longer increases β as if a new rising edge on xExecute is no longer accepted / no longer produces a new message. My trigger logic (simplified) Each PLC cycle, in this order: If the request is fully at rest (NOT xExecute AND NOT xBusy AND NOT xDone AND NOT xError) and a read is pending, I set xExecute := TRUE. I call clientTcp() then clientRequest(rClient := clientTcp) once each, per cycle. On xDone or xError, I set xExecute := FALSE. I made sure to insert at least one full cycle with xExecute = FALSE (seen by the FB call) before re-triggering, so the falling edge is processed. Questions After a ReplyTimeout (xError = TRUE), what is the exact, correct sequence to re-trigger the same ClientRequest so a new message is actually sent again? Is a full cycle with xExecute = FALSE between two executions mandatory? Is there a known condition where, after ReplyTimeout, the ClientTCP keeps xConnected = TRUE but silently stops sending new requests (e.g. an internal request queue / _udiRequestId that gets out of sync)? udiNumMsgSent freezing at 23 while the FB shows _state = None is what puzzles me. Is the recommended pattern to drop the connection (ClientTCP.xConnect := FALSE for one cycle, then TRUE) on a request error, rather than keeping it alive? The docs state a request error does not close the connection, so I kept it open β but maybe that is the issue here. Could the large uiStartItem (50514) be relevant? It works right after download, so addressing seems correct, but I want to rule it out. Any guidance on the canonical recovery pattern after a request timeout would be greatly appreciated. Thanks!
Last updated: 2026-06-19
Reading from a file, a line of CSV values with CrLf at the end of the line.
CODESYS Forge
talk
(Thread)
Reading from a file, a line of CSV values with CrLf at the end of the line.
Last updated: 2018-09-18
Measure Time between events (ms resolution)
CODESYS Forge
talk
(Thread)
Measure Time between events (ms resolution)
Last updated: 2020-05-14
Time will not read 12
CODESYS Forge
talk
(Thread)
Time will not read 12
Last updated: 2024-10-10
RTSEXCEPTION_NOEXCEPTION with Date/Time picker
CODESYS Forge
talk
(Thread)
RTSEXCEPTION_NOEXCEPTION with Date/Time picker
Last updated: 2025-06-27
Date and time to String variable
CODESYS Forge
talk
(Thread)
Date and time to String variable
Last updated: 2025-10-07
How to get system time
CODESYS Forge
talk
(Thread)
How to get system time
Last updated: 2015-01-30
every time I open the project..
CODESYS Forge
talk
(Thread)
every time I open the project..
Last updated: 2022-03-16
Visualization shuting down after some time
CODESYS Forge
talk
(Thread)
Visualization shuting down after some time
Last updated: 2020-05-03
Convert TIME to REAL
CODESYS Forge
talk
(Thread)
Convert TIME to REAL
Last updated: 2017-02-13
Rotating object in design time
CODESYS Forge
talk
(Thread)
Rotating object in design time
Last updated: 2022-03-14
trend visualization time control with ST
CODESYS Forge
talk
(Thread)
trend visualization time control with ST
Last updated: 2023-04-16
Task time of logic functions
CODESYS Forge
talk
(Thread)
Task time of logic functions
Last updated: 2013-05-07
Vorsicht mit Time als Referenz
CODESYS Forge
talk
(Thread)
Vorsicht mit Time als Referenz
Last updated: 2007-05-07
Using RTC Time in Visualization
CODESYS Forge
talk
(Thread)
Using RTC Time in Visualization
Last updated: 2012-03-13
Date and Time picker format
CODESYS Forge
talk
(Thread)
Date and Time picker format
Last updated: 2021-05-26
Getting Real Time Clock Value
CODESYS Forge
talk
(Thread)
Getting Real Time Clock Value
Last updated: 2018-10-03
Help me understand Oscat time function
CODESYS Forge
talk
(Thread)
Help me understand Oscat time function
Last updated: 2019-08-28
Platzhalter fΓΌr Time Variable in Textfeld
CODESYS Forge
talk
(Thread)
Platzhalter fΓΌr Time Variable in Textfeld
Last updated: 2006-10-16
Wago PFC200 Startup/Boot Time
CODESYS Forge
talk
(Thread)
Wago PFC200 Startup/Boot Time
Last updated: 2019-01-09
Display Trend in Local Time
CODESYS Forge
talk
(Thread)
Display Trend in Local Time
Last updated: 2020-07-17
Max Cycle time of task
CODESYS Forge
talk
(Thread)
Max Cycle time of task
Last updated: 2018-04-06
About the programme cycle time
CODESYS Forge
talk
(Thread)
About the programme cycle time
Last updated: 2009-04-13
Getting Real Time Clock Value
CODESYS Forge
talk
(Thread)
Getting Real Time Clock Value
Last updated: 2018-09-13
analog outputs ramp up time?
CODESYS Forge
talk
(Thread)
analog outputs ramp up time?
Last updated: 2016-09-04
To search for an exact phrase, put it in quotes. Example: "getting started docs"
To exclude a word or phrase, put a dash in front of it. Example: docs -help
To search on specific fields, use these field names instead of a general text search. You can group with AND or OR.