sctp_connectx - connect an SCTP socket
cc [ flag... ] file... -lsctp [ library... ] #include <sys/types.h> #include <sys/socket.h> #include <netinet/sctp.h> int sctp_connectx(int sd, struct sockaddr *addrs, int addrcnt, sctp_assoc_t *aid);
The socket descriptor.
If sd is an IPv4 socket, addrs should be an array of sockaddr_in structures containing IPv4 addresses. If sd is an IPv6 socket, addrs should be an array of sockaddr_in6 structures containing IPv6 or IPv4-mapped IPv6 addresses.
The number of addresses in the array addrs.
If the function returns successfully, the association identifier for the newly created association is returned in aid. This parameter is applicable only to one-to-many style SCTP sockets.
The sctp_connectx() function requests an SCTP association to be made on a socket. This is similar to connect(3C) except that an array of peer addresses can be given.
Much like sctp_bindx(3C), 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 sctp_getpaddrs(3C) to retrieve them after the association has been set up.
Upon successful completion, 0 is returned. Otherwise, -1 is returned and errno is set to indicate the error.
The sctp_connectx() function will fail if:
The address is already in use.
No local address is available for this operation.
Addresses in the specified address family cannot be used with this socket.
The socket is non-blocking and a previous connection attempt has not yet been completed.
The sd parameter is not a valid file descriptor.
The attempt to connect was forcefully rejected. The calling program should use connect(3C) to close the socket descriptor, and issue another socket(3C) call to obtain a new descriptor before making another attempt.
A parameter can not be accessed.
The connect attempt was interrupted before it is completed. The attempt will be established asynchronously.
A parameter provided is invalid for this operation.
The socket is already connected.
The network is not reachable from this host.
Insufficient memory is available to complete the operation.
The operation is not supported in this type of socket.
The attempt timed out.
The socket is marked as non-blocking and the requested operation would block.
See attributes(7) for descriptions of the following attributes: