Operating systems, development tools, and professional services
for connected embedded systems
for connected embedded systems
![]() |
![]() |
![]() |
![]() |
sctp_sendmsg()
Send a message, using advanced SCTP features
Synopsis:
#include <netinet/sctp.h>
ssize_t sctp_sendmsg(int s,
const void *msg,
size_t len,
struct sockaddr *to,
socklen_t tolen,
uint32_t ppid,
uint32_t flags,
uint16_t stream_no,
uint32_t timetolive,
uint32_t context);
Arguments:
- s
- Socket descriptor.
- msg
- Message to be sent.
- len
- Length of the message.
- to
- Destination address of the message.
- tolen
- Length of the destination address.
- ppid
- An opaque unsigned value that is passed to the remote end in each user message. The byte order issues are not accounted for and this information is passed opaquely by the SCTP stack from one end to the other.
- flags
- Flags composed of bitwise OR of these values:
- MSG_UNORDERED
- This flag requests the unordered delivery of the message. If the flag is clear, the datagram is considered an ordered send.
- MSG_ADDR_OVER
- This flag, in one-to-many style, requests the SCTP stack to override the primary destination address.
- MSG_ABORT
- This flag causes the specified association to abort -- by sending an ABORT message to the peer (one-to-many style only).
- MSG_EOF
- This flag invokes the SCTP graceful shutdown procedures on the specified association. Graceful shutdown assures that all data enqueued by both endpoints is successfully transmitted before closing the association (one-to-many style only).
- stream_no
- Message stream number -- for the application to send a message. If a sender specifies an invalid stream number, an error indication is returned and the call fails.
- timetolive
- Message time to live in milliseconds. The sending side expires the message within the specified time period if the message has not been sent to the peer within this time period. This value overrides any default value set using socket option. If you use a value of 0, it indicates that no timeout should occur on this message.
- context
- An opaque 32-bit context datum. This value is passed back to the upper layer if an error occurs while sending a message, and is retrieved with each undelivered message.
Library:
libsctp
Use the -l sctp option to qcc to link against this library.
Description:
The sctp_sendmsg() function allows you to send extra information to a remote application. Using advanced SCTP features, you can send a message through a specified stream, pass extra opaque information to a remote application, or define a timeout for the particular message.
Returns:
The number of bytes sent, or -1 if an error occurs (errno is set).
Errors:
- EBADF
- An invalid descriptor was specified.
- EDESTADDRREQ
- A destination address is required.
- EFAULT
- An invalid user space address was specified for a parameter.
- EMSGSIZE
- The socket requires that the message be sent atomically, but the size of the message made this impossible.
- ENOBUFS
- The system couldn't allocate an internal buffer. The operation may succeed when buffers become available.
- ENOTSOCK
- The argument s isn't a socket.
- EWOULDBLOCK
- The socket is marked nonblocking and the requested operation would block.
Classification:
| Safety: | |
|---|---|
| Cancellation point | Yes |
| Interrupt handler | No |
| Signal handler | No |
| Thread | Yes |
See also:
SCTP, sctp_bindx(), sctp_connectx(), sctp_freeladdrs(), sctp_freepaddrs(), sctp_getladdrs(), sctp_getpaddrs(), sctp_peeloff(), sctp_recvmsg(),
![]() |
![]() |
![]() |
![]() |

![[Previous]](../prev.gif)
![[Contents]](../contents.gif)
![[Index]](../keyword_index.gif)
![[Next]](../next.gif)