modbus_close.txt 792 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. modbus_close(3)
  2. ===============
  3. NAME
  4. ----
  5. modbus_close - close a Modbus connection
  6. SYNOPSIS
  7. --------
  8. *void modbus_close(modbus_t *'ctx');*
  9. DESCRIPTION
  10. -----------
  11. The *modbus_close()* function shall close the connection established with the
  12. backend set in the context.
  13. RETURN VALUE
  14. ------------
  15. There is no return value.
  16. EXAMPLE
  17. -------
  18. [source,c]
  19. -------------------
  20. modbus_t *ctx;
  21. ctx = modbus_new_tcp("127.0.0.1", 502);
  22. if (modbus_connect(ctx) == -1) {
  23. fprintf(stderr, "Connection failed: %s\n", modbus_strerror(errno));
  24. modbus_free(ctx);
  25. return -1;
  26. }
  27. modbus_close(ctx);
  28. modbus_free(ctx);
  29. -------------------
  30. SEE ALSO
  31. --------
  32. linkmb:modbus_connect[3]
  33. AUTHORS
  34. -------
  35. The libmodbus documentation was written by Stéphane Raimbault
  36. <stephane.raimbault@gmail.com>