-
Notifications
You must be signed in to change notification settings - Fork 61
建立连接读取数据一段时间后提示modbus: response transaction id '20' does not match request '21' #12
Comments
@dongyuepeng modbus: response transaction id '20' does not match request '21' ,这个理论上不会发生... transaction id是客户端传什么 ,服务端回什么 . 然后第二个问题,有啥问题?? 打印日志是16进制的 |
每次正常通讯十几二十分钟以后就会开始提示这些: |
@dongyuepeng 麻烦提供下串口参数,发送间隔,并发请求是多少. |
😂很久不弄modbus了,我找个时间看一下,如果能谁能修改,麻烦提个PR上来 |
|
这没根本解决问题呀. 如果只是修改超时时间,没必要改代码, 有个WithTCPTimeout可以修改这个超时时间 |
一样有遇到这个问题。 |
理论上我这个设计对于modbus TCP是有问题的. modbus的TCP不同于RTU,ASCII那样必定一主一从. TCP是可以并发的请求,而且还有网络延迟,通过TID来识别某个请求, 需要完全解决这个问题, 可以引入chan, 并起一个goroutine来专门处于收到的回复. 而每个请求需要挂载等回复,超时做丢弃. 可以保证解决这个问题. |
@thinkgos |
同一连接并发请求, 测试并不是依序进行. 异常timeout只对每一个请求 以上是我想的方案, 这是同步的,异步的话,设置回调函数就更简单了. actor模型 |
遇到同样的问题。
现在只能尽量把超时时间拉长。 |
modbusTCPMaster =>2021/07/18 00:47:40 [D]: sending [00 15 00 00 00 06 01 03 00 00 00 08]
modbusTCPMaster =>2021/07/18 00:47:40 [D]: received [00 14 00 00 00 13 01 03 10 00 23 09 4e 00 0d 00 0e 00 0f 00 10 00 00 00 00]
modbus: response transaction id '20' does not match request '21'
请问这个是什么原因造成的?
The text was updated successfully, but these errors were encountered: