1MODBUS_RECEIVE_CONFI(3) libmodbus Manual MODBUS_RECEIVE_CONFI(3)
2
3
4
6 modbus_receive_confirmation - receive a confirmation request
7
9 int modbus_receive_confirmation(modbus_t *ctx, uint8_t *rsp);
10
12 The modbus_receive_confirmation() function shall receive a request via
13 the socket of the context ctx. This function must be used for debugging
14 purposes because the received response isn’t checked against the
15 initial request. This function can be used to receive request not
16 handled by the library.
17
18 The maximum size of the response depends on the used backend, in RTU
19 the rsp array must be MODBUS_RTU_MAX_ADU_LENGTH bytes and in TCP it
20 must be MODBUS_TCP_MAX_ADU_LENGTH bytes. If you want to write code
21 compatible with both, you can use the constant MODBUS_MAX_ADU_LENGTH
22 (maximum value of all libmodbus backends). Take care to allocate enough
23 memory to store responses to avoid crashes of your server.
24
26 The function shall store the confirmation request in rsp and return the
27 response length if successful. The returned request length can be zero
28 if the indication request is ignored (eg. a query for another slave in
29 RTU mode). Otherwise it shall return -1 and set errno.
30
32 uint8_t rsp[MODBUS_MAX_ADU_LENGTH];
33 rc = modbus_receive_confirmation(ctx, rsp);
34
36 modbus_send_raw_request(3)
37
39 The libmodbus documentation was written by Stéphane Raimbault
40 <stephane.raimbault@gmail.com>
41
42
43
44libmodbus v3.1.7 07/20/2023 MODBUS_RECEIVE_CONFI(3)