简体   繁体   English

QModbusRtuSerialMaster 复位输出队列

[英]QModbusRtuSerialMaster reset output queue

Is there a way to reset the output queue for a QModbusRtuSerialMaster instance.有没有办法重置 QModbusRtuSerialMaster 实例的输出队列。

I think that the other end is being saturated with retries which it can't handle, causing QModbusRtuSerialMaster to retry making the problem worse.我认为另一端被它无法处理的重试饱和,导致 QModbusRtuSerialMaster 重试使问题变得更糟。

A possible solution would to reset the output queue, removing pending requests, if there is no reply for a particular message after some time.如果一段时间后没有对特定消息的回复,则可能的解决方案是重置输出队列,删除挂起的请求。

I've looked through the source code and documentation and I can't see any obvious method.我查看了源代码和文档,但看不到任何明显的方法。

I would guess simply closing and re-opening it will not flush the queue immediatly and instead wait for the queue to clear.我想简单地关闭并重新打开它不会立即刷新队列,而是等待队列清除。

I don't think you can.我不认为你可以。 Although there might be some workarounds: for example closing the connection or, since the request queue is handled internally, you can reduce the timeout and the number of retries .尽管可能有一些解决方法:例如关闭连接,或者由于请求队列是在内部处理的,您可以减少超时重试次数

Also, I think that if your slave cannot handle the request, you should change your business logic in order to reduce the request or create your own queue and send them with different timings.另外,我认为如果您的从站无法处理请求,您应该更改业务逻辑以减少请求或创建自己的队列并以不同的时间发送它们。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM