'\" te .\" Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved. .TH sctp_connectx 3SOCKET "5 May 2011" "SunOS 5.11" "Sockets Library Functions" .SH NAME sctp_connectx \- connect an SCTP oscket .SH SYNOPSIS .LP .nf cc [ flag... ] file... -lsocket -lnsl -lsctp [ library... ] #include #include #include int sctp_connectx(int \fIsd\fR, struct sockaddr *\fIaddrs\fR, int \fIaddrcnt\fR, sctp_assoc_t *\fIaid\fR); .fi .SH PARAMETERS .sp .ne 2 .mk .na \fB\fIsd\fR\fR .ad .RS 11n .rt The socket descriptor. .RE .sp .ne 2 .mk .na \fB\fIaddrs\fR\fR .ad .RS 11n .rt If \fIsd\fR is an IPv4 socket, \fIaddrs\fR should be an array of \fBsockaddr_in\fR structures containing IPv4 addresses. If \fIsd\fR is an IPv6 socket, \fIaddrs\fR should be an array of \fBsockaddr_in6\fR structures containing IPv6 or IPv4-mapped IPv6 addresses. .RE .sp .ne 2 .mk .na \fB\fIaddrcnt\fR\fR .ad .RS 11n .rt The number of addresses in the array \fIaddrs\fR. .RE .sp .ne 2 .mk .na \fB\fIaid\fR\fR .ad .RS 11n .rt If the function returns successfully, the association identifier for the newly created association is returned in \fIaid\fR. This parameter is applicable only to one-to-many style SCTP sockets. .RE .SH DESCRIPTION .sp .LP The \fBsctp_connectx()\fR function requests an SCTP association to be made on a socket. This is similar to \fBconnect\fR(3SOCKET) except that an array of peer addresses can be given. .sp .LP Much like \fBsctp_bindx\fR(3SOCKET), this function allows a caller to specify multiple addresses at which a peer can be reached. The SCTP stack tries each addresses in the array in a round robin fashion to set up the association. Note that the list of addresses passed in is only used for setting up the association. It does not necessarily equal the set of addresses the peer uses for the resulting association. If the caller wants to find out the set of peer addresses, it must use \fBsctp_getpaddrs\fR(3SOCKET) to retrieve them after the association has been set up. .SH RETURN VALUES .sp .LP Upon successful completion, 0 is returned. Otherwise, -1 is returned and \fIerrno\fR is set to indicate the error. .SH ERRORS .sp .LP The \fBsctp_connectx()\fR function will fail if: .sp .ne 2 .mk .na \fB\fBEADDRINUSE\fR\fR .ad .RS 17n .rt The address is already in use. .RE .sp .ne 2 .mk .na \fB\fBEADDRNOTAVAIL\fR\fR .ad .RS 17n .rt No local address is available for this operation. .RE .sp .ne 2 .mk .na \fB\fBEAFNOSUPPORT\fR\fR .ad .RS 17n .rt Addresses in the specified address family cannot be used with this socket. .RE .sp .ne 2 .mk .na \fB\fBEALREADY\fR\fR .ad .RS 17n .rt The socket is non-blocking and a previous connection attempt has not yet been completed. .RE .sp .ne 2 .mk .na \fB\fBEBADF\fR\fR .ad .RS 17n .rt The \fIsd\fR parameter is not a valid file descriptor. .RE .sp .ne 2 .mk .na \fB\fBECONNREFUSED\fR\fR .ad .RS 17n .rt The attempt to connect was forcefully rejected. The calling program should use \fBconnect\fR(3SOCKET) to close the socket descriptor, and issue another \fBsocket\fR(3SOCKET) call to obtain a new descriptor before making another attempt. .RE .sp .ne 2 .mk .na \fB\fBEFAULT\fR\fR .ad .RS 17n .rt A parameter can not be accessed. .RE .sp .ne 2 .mk .na \fB\fBEINTR\fR\fR .ad .RS 17n .rt The connect attempt was interrupted before it is completed. The attempt will be established asynchronously. .RE .sp .ne 2 .mk .na \fB\fBEINVAL\fR\fR .ad .RS 17n .rt A parameter provided is invalid for this operation. .RE .sp .ne 2 .mk .na \fB\fBEISCONN\fR\fR .ad .RS 17n .rt The socket is already connected. .RE .sp .ne 2 .mk .na \fB\fBENETUNREACH\fR\fR .ad .RS 17n .rt The network is not reachable from this host. .RE .sp .ne 2 .mk .na \fB\fBENOBUFS\fR\fR .ad .RS 17n .rt Insufficient memory is available to complete the operation. .RE .sp .ne 2 .mk .na \fB\fBEOPNOTSUPP\fR\fR .ad .RS 17n .rt The operation is not supported in this type of socket. .RE .sp .ne 2 .mk .na \fB\fBETIMEDOUT\fR\fR .ad .RS 17n .rt The attempt timed out. .RE .sp .ne 2 .mk .na \fB\fBEWOULDBLOCK\fR\fR .ad .RS 17n .rt The socket is marked as non-blocking and the requested operation would block. .RE .SH ATTRIBUTES .sp .LP See \fBattributes\fR(5) for descriptions of the following attributes: .sp .sp .TS tab() box; cw(2.75i) |cw(2.75i) lw(2.75i) |lw(2.75i) . ATTRIBUTE TYPEATTRIBUTE VALUE _ Interface StabilityCommitted _ MT-LevelSafe .TE .SH SEE ALSO .sp .LP \fBconnect\fR(3SOCKET), \fBlibsctp\fR(3LIB), \fBsctp_bindx\fR(3SOCKET), \fBsctp_getpaddrs\fR(3SOCKET), \fBsocket\fR(3SOCKET), \fBattributes\fR(5), \fBsctp\fR(7P)