1LIBNUTCLIENT_TCP(3) NUT Manual LIBNUTCLIENT_TCP(3)
2
3
4
6 libnutclient_tcp, nutclient_tcp_create_client,
7 nutclient_tcp_is_connected, nutclient_tcp_disconnect,
8 nutclient_tcp_reconnect, nutclient_tcp_set_timeout,
9 nutclient_tcp_get_timeout - TCP protocol related function for Network
10 UPS Tools high-level client access library
11
13 #include <nutclient.h>
14 #include <cstdint> /* uint16_t */
15 #include <ctime> /* time_t */
16
17 typedef NUTCLIENT_t NUTCLIENT_TCP_t;
18
19 NUTCLIENT_TCP_t nutclient_tcp_create_client(
20 const char* host, uint16_t port);
21
22 int nutclient_tcp_is_connected(NUTCLIENT_TCP_t client);
23
24 void nutclient_tcp_disconnect(NUTCLIENT_TCP_t client);
25
26 int nutclient_tcp_reconnect(NUTCLIENT_TCP_t client);
27
28 void nutclient_tcp_set_timeout(NUTCLIENT_TCP_t client, time_t timeout);
29
30 time_t nutclient_tcp_get_timeout(NUTCLIENT_TCP_t client);
31
33 These functions allow to manage connections to upsd(8) using NUT TCP
34 protocol.
35
36 The nutclient_tcp_create_client() function create the NUTCLIENT_TCP_t
37 context and intend to connect to upsd at host and port. The context
38 must be freed by nutclient_destroy()
39
40 • host can be a sever name or a valid IPv4 or IPv6 address like
41 "localhost", "127.0.0.1" or "::1".
42
43 • port is a valid TCP port, generally 3493.
44
45 The nutclient_tcp_is_connected() function test if the connection is
46 valid.
47
48 The nutclient_tcp_disconnect() function force to disconnect the
49 specified connection.
50
51 The nutclient_tcp_reconnect() function force to reconnect a connection,
52 disconnecting it if needed.
53
54 The nutclient_tcp_set_timeout() function set the timeout duration for
55 I/O operations.
56
57 The nutclient_tcp_get_timeout() function retrieve the timeout duration
58 for I/O operations.
59
60 timeout values are specified in seconds, negatives values for blocking.
61
63 libnutclient(3) libnutclient_general(3)
64
65
66
67Network UPS Tools 2.8.0 04/26/2022 LIBNUTCLIENT_TCP(3)