[ Team LiB ] Previous Section Next Section

23.5 Unordered Data

SCTP normally provides reliable ordered delivery of data. SCTP also provides a reliable unordered service. A message with the MSG_UNORDERED flag is sent with no order constraints and is made deliverable as soon as it arrives. Unordered data can be sent in any stream. No stream sequence number is assigned. Figure 23.6 shows the changes needed to our client program to send the request to the echo server with the unordered data service.

Figure 23.6 A sctp_strcli that sends unordered data.

sctp/sctp_strcli_un.c

18     out_sz = strlen(sendline);
19     Sctp_sendmsg(sock_fd, sendline, out_sz,
20                  to, tolen, 0, MSG_UNORDERED, sri.sinfo_stream, 0, 0);

Send data using unordered service

18–20 This is nearly the same as the sctpstr_cli function developed in Section 10.4. On line 21, we see the single change made: The client explicitly passes the MSG_UNORDERED flag to invoke the unordered service. Normally, all data within a given stream is ordered with sequence numbers. The MSG_UNORDERED flag causes the data sent with this flag to be sent unordered, with no sequence number, and can be delivered as soon as it arrives, even if other unordered data that was sent earlier on the same stream has not yet arrived.

    [ Team LiB ] Previous Section Next Section