modbus_receive_confirmation.txt 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. modbus_receive_confirmation(3)
  2. ==============================
  3. NAME
  4. ----
  5. modbus_receive_confirmation - receive a confirmation request
  6. SYNOPSIS
  7. --------
  8. *int modbus_receive_confirmation(modbus_t *'ctx', uint8_t *'rsp');*
  9. DESCRIPTION
  10. -----------
  11. The *modbus_receive_confirmation()* function shall receive a request via the
  12. socket of the context _ctx_. This function must be used for debugging purposes
  13. because the received response isn't checked against the initial request. This
  14. function can be used to receive request not handled by the library.
  15. The maximum size of the response depends on the used backend, in RTU the _rsp_
  16. array must be _MODBUS_RTU_MAX_ADU_LENGTH_ bytes and in TCP it must be
  17. _MODBUS_TCP_MAX_ADU_LENGTH_ bytes. If you want to write code compatible with
  18. both, you can use the constant _MODBUS_MAX_ADU_LENGTH_ (maximum value of all
  19. libmodbus backends). Take care to allocate enough memory to store responses to
  20. avoid crashes of your server.
  21. RETURN VALUE
  22. ------------
  23. The function shall store the confirmation request in _rsp_ and return the
  24. response length if sucessful. The returned request length can be zero if the
  25. indication request is ignored (eg. a query for another slave in RTU
  26. mode). Otherwise it shall return -1 and set errno.
  27. EXAMPLE
  28. -------
  29. [source,c]
  30. -------------------
  31. uint8_t rsp[MODBUS_MAX_ADU_LENGTH];
  32. rc = modbus_receive_confirmation(ctx, rsp);
  33. -------------------
  34. SEE ALSO
  35. --------
  36. linkmb:modbus_send_raw_request[3]
  37. AUTHORS
  38. -------
  39. The libmodbus documentation was written by Stéphane Raimbault
  40. <stephane.raimbault@gmail.com>