modbus_set_error_recovery.txt 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. modbus_set_error_recovery(3)
  2. ============================
  3. NAME
  4. ----
  5. modbus_set_error_recovery - set the error recovery mode
  6. SYNOPSIS
  7. --------
  8. *int modbus_set_error_recovery(modbus_t *'ctx', int 'enabled');*
  9. DESCRIPTION
  10. -----------
  11. The _modbus_set_error_recovery()_ function shall set the error recovery mode to
  12. apply when the connection fails.
  13. By default there is no error recovery so the application must check the error
  14. values returned by libmodbus functions and handle them if necessary.
  15. When enabled, the library will attempt an immediate reconnection which may hang
  16. for several seconds if the network to the remote target unit is down. The write
  17. will try a infinite close/connect loop until to be successful and the
  18. select/read calls will just try to retablish the connection one time then will
  19. return an error (if the connecton was down, the values to read are certainly not
  20. available anymore after reconnection, except for slave/server).
  21. It's not recommanded to enable error recovery for slave/server.
  22. RETURN VALUE
  23. ------------
  24. The _modbus_close()_ function shall return 0 if successful. Otherwise it shall
  25. return -1 and set errno to one of the values defined below.
  26. ERRORS
  27. ------
  28. *EINVAL*::
  29. The value of the argument 'enabled' is not 'TRUE' of 'FALSE'.
  30. AUTHORS
  31. -------
  32. The libmodbus documentation was written by Stéphane Raimbault
  33. <stephane.raimbault@gmail.com>