nut-debian/man/upscli_connect.3
2010-03-26 00:20:59 +01:00

34 lines
1.3 KiB
Groff

.TH UPSCLI_CONNECT 3 "Mon Jan 22 2007" "" "Network UPS Tools (NUT)"
.SH NAME
upscli_connect \- Open a connection to a NUT upsd
.SH SYNOPSIS
.nf
.B #include <upsclient.h>
.sp
.BI "int upscli_connect(UPSCONN *ups, const char *host, int port, int flags);"
.fi
.SH DESCRIPTION
The \fBupscli_connect()\fP function takes the pointer \fIups\fP to a
UPSCONN state structure and opens a TCP connection to the \fIhost\fP on
the given \fIport\fP.
.PP
\fIflags\fP may be either \fBUPSCLI_CONN_TRYSSL\fP to try a SSL
connection, or \fBUPSCLI_CONN_REQSSL\fP to require a SSL connection.
.PP
If SSL mode is required, this function will only return successfully if
it is able to establish a SSL connection with the server. Possible
reasons for failure include no SSL support on the server, and if
\fBupsclient\fR itself hasn't been compiled with SSL support.
.PP
You must call \fBupscli_disconnect\fP(3) when finished with a
connection, or your program will slowly leak memory and file
descriptors.
.SH "RETURN VALUE"
The \fBupscli_connect()\fP function modifies the UPSCONN structure and
returns 0 on success, or \-1 if an error occurs.
.SH "SEE ALSO"
.BR upscli_disconnect "(3), "upscli_fd "(3), "
.BR upscli_splitaddr "(3), "upscli_splitname "(3), "
.BR upscli_ssl "(3), "upscli_strerror "(3), "
.BR upscli_upserror "(3) "