.\" openfwtk project: conn_server.3 1-Nov-2000 .TH conn_server 3 .SH NAME conn_server() \- connect to a server by name and port .SH SYNOPSIS .nf #include "fwfunc.h" .fi .sp int \fBconn_server\fP(char *srv,int portnum,int priv,char *rbuf) .SH DESCRIPTION The \fIconn_server\fP function creates a socket, connected to tcp server \fIsrv\fP's port \fIportnum\fP, using highest available privileged source port if \fIpriv\fP is non-zero, and any one as regular tcp connection does if it is zero. .PP If a host has multiple IPs in dns recored, each is tried until some succeeds or list is exhausted. .SH RETURN VALUES the function returns socket number on success or a negative value if something fails (-1 if server name does not resolve or invalid, -2 if socket failed to create and -3 if connect failed). A failure reason is written into string pointed by rbuf, if it is specified. .SH SECURITY CONDITIONS address entry returned by name lookup exceeds sizeof appropriate structure, \fBaction:\fP 'invalid host address length' securityalert is generated, -1 returned. .SH SEE ALSO rresvport(3),connect(2) .SH HISTORY The function appears in fwtk since v1.0