Closed harihanv closed 13 years ago
Which loop? Could you send me your modified code? Do you use the new the tarball for v2.9.3?
I have used the tarball v2.9.3. To pass all the test cases, I have modified for loop in the unit-test-server.c to flush data. please find the snippet of code for reference, i have also marked "modbus_flush" function in bold.
for (;;) { rc = modbus_receive(ctx, -1, query); if (rc == -1) { /* Connection closed by the client or error */ break; }
/* Read holding registers */
if (query[header_length] == 0x03) {
if (MODBUS_GET_INT16_FROM_INT8(query, header_length + 3)
== UT_REGISTERS_NB_POINTS_SPECIAL) {
printf("Set an incorrect number of values\n");
MODBUS_SET_INT16_TO_INT8(query, header_length + 3,
UT_REGISTERS_NB_POINTS);
} else if (MODBUS_GET_INT16_FROM_INT8(query, header_length + 1)
== UT_REGISTERS_ADDRESS_SPECIAL) {
modbus_reply_exception(ctx, query,
MODBUS_EXCEPTION_SLAVE_OR_SERVER_BUSY);
continue;
}
}
rc = modbus_reply(ctx, query, rc, mb_mapping);
if (rc == -1) {
break;
}
modbus_flush(ctx);
OK, it's just a workaround but unit tests contain many strange things on purpose so I don't want to hide them with this call. I don't have the problem on my computer so could you post at least 25 lines of history of server/client tests (github offers a pastebin like). Did you use TCP tests on localhost?
When i was testing the libmodbus 2.9.3 , i observed the following error in the server
Waiting for a indication...
<11><03><00>