slave id check should be disabled in TCP connection
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
libmodbus |
Fix Committed
|
Medium
|
Stéphane Raimbault |
Bug Description
According to Page6 in the document "MODBUS Messaging on TCP/IP Implementation Guide V1.0b",
-------
Unit Identifier – This field is used for intra-system routing purpose. It is typically used to communicate to a MODBUS+ or a MODBUS serial line slave through a gateway between an Ethernet TCP-IP network and a MODBUS serial line. This field is set by the MODBUS Client in the request and must be returned with the same value in the response by the server.
-------
So when it's a TCP connection, the slave id check should be disabled in the function modbus_
if (slave != mb_param->slave && slave != MODBUS_
// Ignores the query (not for me)
if (mb_param->debug) {
}
}
You're right the slave must be set to 0xFF (I'm sure to have already seen this problem years ago...)
The page 23 better explains how to define unit identifier field in TCP Modbus header (the proxy to serial device must be handled).
I've committed the change and I'm currently modifying the API to still coherent.