1MODBUS_CLOSE(3)                Libmodbus Manual                MODBUS_CLOSE(3)
2
3
4

NAME

6       modbus_close - close a Modbus connection
7

SYNOPSIS

9       void modbus_close(modbus_t *ctx);
10

DESCRIPTION

12       The modbus_close() function shall close the connection established with
13       the backend set in the context.
14

RETURN VALUE

16       There is no return value.
17

EXAMPLE

19           modbus_t *ctx;
20
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
28           modbus_close(ctx);
29           modbus_free(ctx);
30

SEE ALSO

32       modbus_connect(3)
33

AUTHORS

35       The libmodbus documentation was written by Stéphane Raimbault
36       <stephane.raimbault@gmail.com[1]>
37

NOTES

39        1. stephane.raimbault@gmail.com
40           mailto:stephane.raimbault@gmail.com
41
42
43
44libmodbus 3.0.8                   07/31/2019                   MODBUS_CLOSE(3)
Impressum