libnutclient_tcp - Man Page

TCP protocol related function for Network UPS Tools high-level client access library


#include <nutclient.h>
#include <cstdint> /* uint16_t */
#include <ctime> /* time_t */
NUTCLIENT_TCP_t nutclient_tcp_create_client(
        const char* host, uint16_t port);
int nutclient_tcp_is_connected(NUTCLIENT_TCP_t client);
void nutclient_tcp_disconnect(NUTCLIENT_TCP_t client);
int nutclient_tcp_reconnect(NUTCLIENT_TCP_t client);
void nutclient_tcp_set_timeout(NUTCLIENT_TCP_t client, time_t timeout);
time_t nutclient_tcp_get_timeout(NUTCLIENT_TCP_t client);


These functions allow to manage connections to upsd(8) using NUT TCP protocol.

The nutclient_tcp_create_client() function create the NUTCLIENT_TCP_t context and intend to connect to upsd at host and port. The context must be freed by nutclient_destroy()

The nutclient_tcp_is_connected() function test if the connection is valid.

The nutclient_tcp_disconnect() function force to disconnect the specified connection.

The nutclient_tcp_reconnect() function force to reconnect a connection, disconnecting it if needed.

The nutclient_tcp_set_timeout() function set the timeout duration for I/O operations.

The nutclient_tcp_get_timeout() function retrieve the timeout duration for I/O operations.

timeout values are specified in seconds, negatives values for blocking.

See Also

libnutclient(3) libnutclient_general(3)

Referenced By


The man pages nutclient_tcp_create_client(3), nutclient_tcp_disconnect(3), nutclient_tcp_get_timeout(3), nutclient_tcp_is_connected(3), nutclient_tcp_reconnect(3) and nutclient_tcp_set_timeout(3) are aliases of libnutclient_tcp(3).

04/26/2022 Network UPS Tools 2.8.0 NUT Manual