SCTP Programmer's Guide

The listen() Socket API
Applications use listen() to prepare the SCTP endpoint for accepting inbound
associations.
Following is the syntax for the listen() socket API:
int listen(int sd, int backlog);
where:
sd
Represents the socket descriptor of the SCTP endpoint.
backlog
Represents the maximum number of outstanding associations allowed in
the accept queue of the socket. These associations have completed the
four-way initiation handshake and are in the ESTABLISHED state. A
backlog of 0 (zero) indicates that the caller no longer wants to receive new
associations.
The accept() Socket API
Applications use the accept() call to remove an established SCTP association from
the accept queue. The accept() API returns a new socket descriptor, to represent the
newly formed association.
Following is the syntax for the accept() socket API:
new_sd = accept(int sd, struct sockaddr *addr, socklen_t *addrlen);
where:
new_sd
Represents the socket descriptor for the newly formed association.
sd
Represents the listening socket descriptor.
addr
Contains the primary address of the peer endpoints.
addrlen Specifies the size of addr.
The connect() Socket API
Applications use connect() to initiate an association with a peer.
Following is the syntax for the connect() socket API:
int connect(int sd, const struct sockaddr *addr, socklen_t addrlen);
where:
sd
Represents the socket descriptor of the endpoint.
addr
Represents the address of the peer.
addrlen
Represents the size of the address.
By default, the newly created association has only one outbound stream. Applications
must use the SCTP_INITMSG option before connecting to the server, to change the
number of outbound streams. The SCTP_INITMSG option enables you to set a socket
option and get a socket option, using the setsockopt() and getsockopt() APIs.
Different Socket API Styles 45