nut/docs/man/libnutclient_tcp.txt

71 lines
1.9 KiB
Text
Raw Normal View History

2013-11-24 15:00:12 +00:00
LIBNUTCLIENT_TCP(3)
===================
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 -
2022-06-29 10:37:36 +00:00
TCP protocol related function for Network UPS Tools high-level client
access library
2013-11-24 15:00:12 +00:00
SYNOPSIS
--------
#include <nutclient.h>
2022-06-29 10:37:36 +00:00
#include <cstdint> /* uint16_t */
#include <ctime> /* time_t */
2013-11-24 15:00:12 +00:00
typedef NUTCLIENT_t NUTCLIENT_TCP_t;
2022-06-29 10:37:36 +00:00
NUTCLIENT_TCP_t nutclient_tcp_create_client(
const char* host, uint16_t port);
2013-11-24 15:00:12 +00:00
int nutclient_tcp_is_connected(NUTCLIENT_TCP_t client);
2022-06-29 10:37:36 +00:00
2013-11-24 15:00:12 +00:00
void nutclient_tcp_disconnect(NUTCLIENT_TCP_t client);
2022-06-29 10:37:36 +00:00
2013-11-24 15:00:12 +00:00
int nutclient_tcp_reconnect(NUTCLIENT_TCP_t client);
2022-06-29 10:37:36 +00:00
void nutclient_tcp_set_timeout(NUTCLIENT_TCP_t client, time_t timeout);
time_t nutclient_tcp_get_timeout(NUTCLIENT_TCP_t client);
2013-11-24 15:00:12 +00:00
DESCRIPTION
-----------
2022-06-29 10:37:36 +00:00
These functions allow to manage connections to linkman:upsd[8]
using NUT TCP protocol.
2013-11-24 15:00:12 +00:00
2022-06-29 10:37:36 +00:00
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()'
2013-11-24 15:00:12 +00:00
2022-06-29 10:37:36 +00:00
* 'host' can be a sever name or a valid IPv4 or IPv6 address like
"localhost", "127.0.0.1" or "::1".
2013-11-24 15:00:12 +00:00
2022-06-29 10:37:36 +00:00
* 'port' is a valid TCP port, generally 3493.
2013-11-24 15:00:12 +00:00
The *nutclient_tcp_is_connected()* function test if the connection is valid.
2022-06-29 10:37:36 +00:00
The *nutclient_tcp_disconnect()* function force to disconnect the specified
connection.
2013-11-24 15:00:12 +00:00
The *nutclient_tcp_reconnect()* function force to reconnect a connection,
disconnecting it if needed.
2022-06-29 10:37:36 +00:00
The *nutclient_tcp_set_timeout()* function set the timeout duration
for I/O operations.
2013-11-24 15:00:12 +00:00
2022-06-29 10:37:36 +00:00
The *nutclient_tcp_get_timeout()* function retrieve the timeout duration
for I/O operations.
2013-11-24 15:00:12 +00:00
'timeout' values are specified in seconds, negatives values for blocking.
SEE ALSO
--------
2022-06-29 10:37:36 +00:00
2013-11-24 15:00:12 +00:00
linkman:libnutclient[3]
linkman:libnutclient_general[3]