1MODBUS_CLOSE(3) Libmodbus Manual MODBUS_CLOSE(3)
2
3
4
6 modbus_close - close a Modbus connection
7
9 void modbus_close(modbus_t *ctx);
10
12 The modbus_close() function shall close the connection established with
13 the backend set in the context.
14
16 There is no return value.
17
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
32 modbus_connect(3)
33
35 The libmodbus documentation was written by Stéphane Raimbault
36 <stephane.raimbault@gmail.com[1]>
37
39 1. stephane.raimbault@gmail.com
40 mailto:stephane.raimbault@gmail.com
41
42
43
44libmodbus 3.0.6 04/02/2014 MODBUS_CLOSE(3)