File: libnutclient_tcp.txt

package info (click to toggle)
nut 2.8.1-5
  • links: PTS, VCS
  • area: main
  • in suites: trixie
  • size: 18,284 kB
  • sloc: ansic: 108,785; sh: 9,370; cpp: 3,370; makefile: 2,842; python: 1,029; perl: 763; xml: 47
file content (70 lines) | stat: -rw-r--r-- 1,906 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
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 -
TCP protocol related function for Network UPS Tools high-level client
access library

SYNOPSIS
--------

	#include <nutclient.h>
	#include <cstdint> /* uint16_t */
	#include <ctime> /* time_t */

	typedef NUTCLIENT_t NUTCLIENT_TCP_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);

DESCRIPTION
-----------

These functions allow to manage connections to linkman: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()'

* 'host' can be a sever name or a valid IPv4 or IPv6 address like
"localhost", "127.0.0.1" or "::1".

* 'port' is a valid TCP port, generally 3493.

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
--------

linkman:libnutclient[3]
linkman:libnutclient_general[3]