1UPSCLI_CONNECT(3)           Network UPS Tools (NUT)          UPSCLI_CONNECT(3)
2
3
4

NAME

6       upscli_connect - Open a connection to a NUT upsd
7

SYNOPSIS

9       #include <upsclient.h>
10
11       int upscli_connect(UPSCONN *ups, const char *host, int port, int flags);
12

DESCRIPTION

14       The  upscli_connect() function takes the pointer ups to a UPSCONN state
15       structure and opens a TCP connection to the host on the given port.
16
17       flags may be either UPSCLI_CONN_TRYSSL to  try  a  SSL  connection,  or
18       UPSCLI_CONN_REQSSL to require a SSL connection.
19
20       If SSL mode is required, this function will only return successfully if
21       it is able to establish a SSL connection  with  the  server.   Possible
22       reasons  for  failure  include  no  SSL  support  on the server, and if
23       upsclient itself hasn't been compiled with SSL support.
24
25       You must call upscli_disconnect(3) when finished with a connection,  or
26       your program will slowly leak memory and file descriptors.
27

RETURN VALUE

29       The  upscli_connect()  function  modifies  the  UPSCONN  structure  and
30       returns 0 on success, or -1 if an error occurs.
31

SEE ALSO

33       upscli_disconnect(3), upscli_fd(3), upscli_splitname(3), upscli_ssl(3),
34       upscli_strerror(3), upscli_upserror(3)
35
36
37
38                                Wed Oct 16 2002              UPSCLI_CONNECT(3)
Impressum