SCTP Programmer's Guide

NOTE: A sendmsg() API does not fail if it contains an invalid SCTP stream identifier
but an error is returned on all subsequent calls on the file descriptor.
The getpeername() Socket API
Applications use the getpeername() socket API to retrieve the primary socket address
of the peer.
Following is the syntax for the getpeername() socket API:
int getpeername(int sd, struct sockaddr *address, socklen_t *len);
where:
sd
Specifies the socket descriptor to be queried.
address
Contains the primary peer address. If the socket is an IPv4 socket, the
address will be an IPv4 address. If the socket is an IPv6 socket, the address
will be either an IPv6 or an IPv4 address.
len
Specifies the length of the address.
If the actual length of the address is greater than the length of the supplied sockaddr
structure, SCTP truncates the stored address.
NOTE: The getpeername() socket API is available only for TCP compatibility. It
must not be used for the multihoming feature in SCTP, because this socket API does
not work with one-to-many style sockets.
One-to-Many Socket APIs
The one-to-many style APIs are designed to enable applications to control many
associations from a single endpoint, using a single file descriptor. Similar to the APIs
in UDP, one-to-many style APIs in SCTP enable a single socket file descriptor to connect
to multiple remote endpoints. A one-to-many style socket can send and receive data
without connecting to an endpoint. Unlike UDP, however, SCTP always has a valid
association with the specified endpoints, because SCTP is a connection-oriented protocol.
Basic One-to-Many Call Flow Sequence
A server in the one-to-many style uses the following socket call sequence to prepare
an endpoint for servicing requests:
1. socket()
2. bind() or sctp_bindx()
3. sctp_getladdrs()
4. sctp_freeladdrs()
5. listen()
6. sctp_getpaddrs()
48 SCTP Socket APIs