Transport protocols in IP networks, such as TCP and UDP, benefit from the sockets API. A sockets API provides a standard design interface across diverse operating systems and multiple platforms. This section describes the socket's API that is used to introduce SCTP services into TCP and UDP based applications.
In the following applications, the active primary endpoint that issues establishment requests has been denoted as the "client." The passive endpoint that receives establishment requests has been denoted as the "server."
UDPStyle Interface
The UDPstyle interface accepts inbound association automatically and supports the delivery of complete messages. In addition, individual interfaces use a set of calls that execute the responses. In an SCTP association, the client and the server use these calls to establish an association. Table 2 describes the functions of UDPstyle-interface calls in sequence.
| Sq | CALLS | DEFINITION |
| 1 | socket () | The socket() call creates a socket descriptor to represent SCTP endpoint. |
| 2 | bind() | The bind() call designates the primary address from the list of local addresses. |
| 3 | setsocketopt() | The setsocketopt() call sets the default association parameters. |
| 4 | rcvmsg() | The rcvmsg() call requests that data be received from the endpoint. |
| 5 | sendmsg() | The sendmsg() call requests that data be transmitted to the endpoint. |
| 6 | close() | The close() call performs a graceful shutdown. |
Table 2: UDPStyle-Interface Calls for the Server to Prepare Itself for Servicing Requests
The client uses the same interface calls listed in Table 2 except for possibly bind() and setsocketopt() calls, which are handled by the server. In case the client or server wants to divert an existing association to a separate socket, the sctp_peeloff() call is available.
TCPStyle Interface
Since TCP connections are more prevalent in IP networks, the TCPstyle interface enables connection oriented protocols to be linked with SCTP. Similar to the UDPstyle interface, the client and server execute calls in the sequence described in Table 3.
| Sq | CALLS | DEFINITION |
| 1 | socket () | The socket() call generates a socket descriptor corresponding to an SCTP endpoint. |
| 2 | bind() | The bind() call is used to bypass the primary address associated with the SCTP endpoint. |
| 3 | listen() | The listen() call prepares the SCTP endpoint to receive inbound associations. |
| 4 | accept() | The accept() call blocks the endpoint until a new association is initialized and a new socket descriptor is returned. |
| 5 | close() | The close() call is used to terminate an association. |
Table 3: TCPStyle Interface Calls for the Server to Prepare itself for Servicing Requests
While the server executes the calls described in Table 3, the client uses a separate set of calls to set up an association with a server. These calls are listed in sequence in Table 4.
| Sq | CALLS | DEFINITION |
| 1 | socket () | The socket() call generates a socket descriptor corresponding to the SCTP endpoint. |
| 2 | connect() | The connect() call is used to initiate an association with the peer endpoint. |
| 3 | sendmsg() | The sendmsg() call is used to send a request to the server. |
| 4 | recvmsg() | The recvmsg() call is used to receive messages from the server. |
| 5 | close() | The close() call is used to terminate an association. |
Table 4: TCPStyle-Interface Calls for the client to set up an association with a server.
The API sendmsg() and recvmsg() calls contain unique data structures that control endpoints and provide access to supplementary information.


