2013-11-24 17:00:12 +02:00
'\" t
. \" Title: libnutclient_tcp
2022-07-10 10:23:45 +03:00
. \" Author: [FIXME: author] [see http://www.docbook.org/tdg5/en/html/author]
. \" Generator: DocBook XSL Stylesheets vsnapshot <http://docbook.sf.net/>
. \" Date: 04/26/2022
2013-11-24 17:00:12 +02:00
. \" Manual: NUT Manual
2022-07-10 10:23:45 +03:00
. \" Source: Network UPS Tools 2.8.0
2013-11-24 17:00:12 +02:00
. \" Language: English
. \"
2022-07-10 10:23:45 +03:00
.TH "LIBNUTCLIENT_TCP" "3" "04/26/2022" "Network UPS Tools 2\&.8\&.0" "NUT Manual"
2013-11-24 17:00:12 +02:00
. \" -----------------------------------------------------------------
. \" * Define some portability stuff
. \" -----------------------------------------------------------------
. \" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
. \" http://bugs.debian.org/507673
. \" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html
. \" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.ie \n (.g .ds Aq \(aq
.el .ds Aq '
. \" -----------------------------------------------------------------
. \" * set default formatting
. \" -----------------------------------------------------------------
. \" disable hyphenation
.nh
. \" disable justification (adjust text to left margin only)
.ad l
. \" -----------------------------------------------------------------
. \" * MAIN CONTENT STARTS HERE *
. \" -----------------------------------------------------------------
.SH "NAME"
libnutclient_tcp, nutclient_tcp_create_client, nutclient_tcp_is_connected, nutclient_tcp_disconnect, nutclient_tcp_reconnect, nutclient_tcp_set_timeout, nutclient_tcp_get_timeout \- TCP protocol related function for Network UPS Tools high\- level client access library
.SH "SYNOPSIS"
.sp
.nf
#include <nutclient\& .h>
2022-07-10 10:23:45 +03:00
#include <cstdint> /* uint16_t */
#include <ctime> /* time_t */
2013-11-24 17:00:12 +02:00
.fi
.sp
.nf
typedef NUTCLIENT_t NUTCLIENT_TCP_t;
.fi
.sp
.nf
2022-07-10 10:23:45 +03:00
NUTCLIENT_TCP_t nutclient_tcp_create_client(
const char* host, uint16_t port);
.fi
.sp
.nf
2013-11-24 17:00:12 +02:00
int nutclient_tcp_is_connected(NUTCLIENT_TCP_t client);
2022-07-10 10:23:45 +03:00
.fi
.sp
.nf
2013-11-24 17:00:12 +02:00
void nutclient_tcp_disconnect(NUTCLIENT_TCP_t client);
2022-07-10 10:23:45 +03:00
.fi
.sp
.nf
2013-11-24 17:00:12 +02:00
int nutclient_tcp_reconnect(NUTCLIENT_TCP_t client);
2022-07-10 10:23:45 +03:00
.fi
.sp
.nf
void nutclient_tcp_set_timeout(NUTCLIENT_TCP_t client, time_t timeout);
.fi
.sp
.nf
time_t nutclient_tcp_get_timeout(NUTCLIENT_TCP_t client);
2013-11-24 17:00:12 +02:00
.fi
.SH "DESCRIPTION"
.sp
These functions allow to manage connections to \fB upsd\fR (8) using NUT TCP protocol\& .
.sp
The \fB nutclient_tcp_create_client()\fR function create the \fI NUTCLIENT_TCP_t\fR context and intend to connect to upsd at \fI host\fR and \fI port\fR \& . The context must be freed by \fI nutclient_destroy()\fR
.sp
2022-07-10 10:23:45 +03:00
.RS 4
.ie n \{ \
\h '-04'\(bu \h '+03'\c
. \}
.el \{ \
.sp -1
.IP \(bu 2 .3
. \}
\fI host\fR
can be a sever name or a valid IPv4 or IPv6 address like "localhost", "127\& .0\& .0\& .1" or "::1"\& .
.RE
2013-11-24 17:00:12 +02:00
.sp
2022-07-10 10:23:45 +03:00
.RS 4
.ie n \{ \
\h '-04'\(bu \h '+03'\c
. \}
.el \{ \
.sp -1
.IP \(bu 2 .3
. \}
\fI port\fR
is a valid TCP port, generally 3493\& .
.RE
2013-11-24 17:00:12 +02:00
.sp
The \fB nutclient_tcp_is_connected()\fR function test if the connection is valid\& .
.sp
The \fB nutclient_tcp_disconnect()\fR function force to disconnect the specified connection\& .
.sp
The \fB nutclient_tcp_reconnect()\fR function force to reconnect a connection, disconnecting it if needed\& .
.sp
The \fB nutclient_tcp_set_timeout()\fR function set the timeout duration for I/O operations\& .
.sp
The \fB nutclient_tcp_get_timeout()\fR function retrieve the timeout duration for I/O operations\& .
.sp
\fI timeout\fR values are specified in seconds, negatives values for blocking\& .
.SH "SEE ALSO"
.sp
\fB libnutclient\fR (3) \fB libnutclient_general\fR (3)