SCTP Programmer's Guide

If SCTP does not call the bind() API before calling connect() , the application picks
a transient port and chooses an address set that is equivalent to binding with
INADDR_ANY and IN6ADDR_ANY for IPv4 and IPv6 sockets, respectively. One of these
addresses serves as the primary address for the association. When an application calls
bind() with the INADDR_ANY or the IN6ADDR_ANY_INIT wildcard address, the
multihoming feature is enabled in SCTP.
The close() Socket API
Applications use close() to gracefully close down an association.
Following is the syntax for the close() socket API:
int close(int sd);
where:
sd
Represents the socket descriptor of the association to be closed.
After an application calls close() on a socket descriptor, no further socket operations
succeed on that descriptor.
The shutdown() Socket API
Applications use the shutdown() socket API to disable send or receive operations at
an endpoint. The effect of the shutdown() call is different in SCTP and TCP. In TCP,
a connection is in half-closed state even after an application calls shutdown(). In the
half-close state, an application at the sending endpoint continues to send data even if
an application at the receiving endpoint has stopped receiving data. In SCTP,
shutdown() completely disables applications at both the endpoints from sending or
receiving data.
NOTE: Applications can use the SCTP streams feature to achieve the half closed state
in SCTP.
Following is the syntax for the shutdown() socket call:
int shutdown(int sd, int how);
sd
Specifies the socket descriptor of the association that needs to be closed.
how
Specifies the type of shutdown. The values are as follows:
SHUT_RD
Disables further receive operations
SHUT_WR
Disables further send operations and initiates the SCTP shutdown
sequence
SHUT_RDWR
Disables further send and receive operations, and initiates the
SCTP shutdown sequence
In SCTP, SHUT_WR initiates an immediate and full protocol shutdown. In TCP, SHUT_WR
causes TCP to enter a half-closed state. The SHUT_RD value behaves in the same way
for SCTP and TCP. SCTP_WR closes the SCTP association while leaving the socket
46 SCTP Socket APIs