stephane / libmodbus

A Modbus library for Linux, Mac OS, FreeBSD and Windows
http://libmodbus.org
GNU Lesser General Public License v2.1
3.3k stars 1.71k forks source link

The set response timeout is 200ms, but the actual time is 400ms #608

Open teaczjf opened 2 years ago

teaczjf commented 2 years ago

hi! i set the timeout
modbus_set_response_timeout(pObj->m_modbus, 0,200* 1000); //timeout=200ms but the result turn out is 400ms

this is my code

LOG(WARNING) << "#######################开始读取"<< "modbusid_cur= " << modbusid_cur;
ret = modbus_read_registers(pObj->m_modbus, item->second.address(), 8, checkbuff);
LOG(WARNING) << "#######################结束读取" << "modbusid_cur= " << modbusid_cur ;

this is my log

2021-11-26 10:39:45,317 #######################开始读取modbusid_cur= 2 slave_id_cur= 2
2021-11-26 10:39:47,719 #######################结束读取modbusid_cur= 2 slave_id_cur= 2

libmodbus version

<#define LIBMODBUS_VERSION 3.1.6>

OS and/or distribution

< Linux>

Environment

<e.g. CPU architecture,64 bit...>

Description

<The set response timeout is 200ms, but the actual time is 400ms>

Jasper-Bai commented 1 year ago

same problem for me. have u solved it ? could u tell me?

teaczjf commented 1 year ago

收到       以上为自动回复