sctp_getpaddrs
() Function
The sctp_getpaddrs
() function returns all peer addresses
in an association.
int sctp_getpaddrs(sock, id, **addrs); int sock, sctp_assoc_t id, void **addrs;
When the sctp_getpaddrs
() function returns successfully, the value of the **addrs
parameter points to a dynamically allocated packed array of sockaddr
structures of the appropriate type for each address. The calling thread frees the memory with the sctp_freepaddrs
() function. The **addrs
parameter cannot have a value of NULL
. If the socket descriptor given in sock
is for an IPv4 socket, the sctp_getpaddrs
() function returns IPv4 addresses. If the socket descriptor given in sock
is for an IPv6 socket, the sctp_getpaddrs
() function returns a mix of IPv4 and IPv6 addresses. For one-to-many sockets model, the id
parameter specifies the association to query. The sctp_getpaddrs
() function ignores the id
parameter for one-to-one socket model. When the sctp_getpaddrs
() function returns successfully, it returns the number of peer addresses in the association. If there is no association on this socket, the sctp_getpaddrs
() function returns 0 and the value of the **addrs
parameter is undefined. If an error occurs, the sctp_getpaddrs
() function returns -1 and the value of the **addrs
parameter is undefined.
If the file descriptor passed to the sctp_getpaddrs
() function in the sock
parameter is invalid, the sctp_getpaddrs
() function fails and returns EBADF
. If the file descriptor passed to the sctp_getpaddrs
() function in the sock
parameter does not describe a socket, the sctp_getpaddrs
() function fails and returns ENOTSOCK
. If the file descriptor passed to the sctp_getpaddrs
() function in the sock
parameter describes a socket that is not connected, the sctp_getpaddrs
() function fails and returns ENOTCONN
.