1

Topic: The strange behavior libmodbus

Kind time of days! I write modbus-rtu the master with usage libmodbus. I test on two controlers on one line. One is responsible for the ~10 msec, the second for 15. And here when business reaches number change  (modbus_set_slave) the time delay on this call sometimes reaches to 400-500 msec. vector <uint8_t> data; modbus_set_slave (ctx, 2); int r1 = modbus_read_bits (ctx, 20, 10, data.data ()); modbus_set_slave (iface.get_context (), 1); int r2 = modbus_read_bits (ctx, 20, 10, data.data ()); At by a repeated call modbus_set_slave with identical argument of such time delay is not present, i.e. it appears only in a case when number  really changes. To me not clearly such behavior, and also is not clear, whether the library tracks calls to a context from different flows therefore as I long implemented protection against simultaneous reversal of several flows to one context and will be insulting to learn that all it is already implemented by All in advance thanks for interesting and useful answers : system: Ubuntu 17.10 x86.