Go to main content

man pages section 3: Basic Library Functions

Exit Print View

Updated: Thursday, June 13, 2019
 
 

sctp_connectx(3C)

Name

sctp_connectx - connect an SCTP socket

Synopsis

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);

Parameters

sd

The socket descriptor.

addrs

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.

addrcnt

The number of addresses in the array addrs.

aid

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.

Description

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.

Return Values

Upon successful completion, 0 is returned. Otherwise, -1 is returned and errno is set to indicate the error.

Errors

The sctp_connectx() function will fail if:

EADDRINUSE

The address is already in use.

EADDRNOTAVAIL

No local address is available for this operation.

EAFNOSUPPORT

Addresses in the specified address family cannot be used with this socket.

EALREADY

The socket is non-blocking and a previous connection attempt has not yet been completed.

EBADF

The sd parameter is not a valid file descriptor.

ECONNREFUSED

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.

EFAULT

A parameter can not be accessed.

EINTR

The connect attempt was interrupted before it is completed. The attempt will be established asynchronously.

EINVAL

A parameter provided is invalid for this operation.

EISCONN

The socket is already connected.

ENETUNREACH

The network is not reachable from this host.

ENOBUFS

Insufficient memory is available to complete the operation.

EOPNOTSUPP

The operation is not supported in this type of socket.

ETIMEDOUT

The attempt timed out.

EWOULDBLOCK

The socket is marked as non-blocking and the requested operation would block.

Attributes

See attributes(7) for descriptions of the following attributes:

ATTRIBUTE TYPE
ATTRIBUTE VALUE
Interface Stability
Committed
MT-Level
Safe

See Also

connect(3C), sctp_bindx(3C), sctp_getpaddrs(3C), socket(3C), libsctp(3LIB), sctp(4P), attributes(7)