Martin Galvan
unread,May 4, 2016, 4:55:15 PM5/4/16Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Sign in to report message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to libm...@googlegroups.com
Currently, random-test-client sends messages from ADDRESS_START to ADDRESS_END.
When it reaches ADDRESS_END, the number of bytes to write is zero, which causes the
server to reply with exception messages for some of the requests:
Waiting for a indication...
<03><E1><00><00><00><07><FF><0F><00><63><00><00><00>
Illegal number of values 0 in write_bits (max 1968)
Bytes flushed (0)
...
Waiting for a indication...
<03><E4><00><00><00><07><FF><10><00><63><00><00><00>
Illegal number of values 0 in write_registers (max 123)
Bytes flushed (0)
...
Waiting for a indication...
<03><E5><00><00><00><0B><FF><17><00><63><00><00><00><63><00><00><00>
Illegal nb of values (W0, R0) in write_and_read_registers (max W121, R125)
Bytes flushed (0)
The client in turn shows:
<03><E1><00><00><00><03><FF><8F><03>
ERROR Illegal data value
ERROR modbus_write_bits (-1)
Address = 99, nb = 0
...
<03><E4><00><00><00><03><FF><90><03>
ERROR Illegal data value
ERROR modbus_write_registers (-1)
Address = 99, nb = 0
...
<03><E5><00><00><00><03><FF><97><03>
ERROR Illegal data value
ERROR modbus_read_and_write_registers (-1)
Address = 99, nb = 0
This patch simply makes the client loop stop when it reaches ADDRESS_END - 1.
---
tests/random-test-client.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tests/random-test-client.c b/tests/random-test-client.c
index 69c9b0a..2ebbded 100644
--- a/tests/random-test-client.c
+++ b/tests/random-test-client.c
@@ -86,7 +86,7 @@ int main(void)
nb_loop = nb_fail = 0;
while (nb_loop++ < LOOP) {
- for (addr = ADDRESS_START; addr <= ADDRESS_END; addr++) {
+ for (addr = ADDRESS_START; addr < ADDRESS_END; addr++) {
int i;
/* Random numbers (short) */
--
2.8.2