|
NAMEsctp_sendmsg , sctp_sendmsgx
—
send a message from an SCTP socket
LIBRARYStandard C Library (libc, -lc)SYNOPSIS#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/sctp.h>
ssize_t
ssize_t
DESCRIPTIONThesctp_sendmsg () system call is used to transmit a
message to another SCTP endpoint. The sctp_sendmsg ()
may be used at any time. If the socket is a one-to-many type (SOCK_SEQPACKET)
socket then an attempt to send to an address that no association exists to
will implicitly create a new association. Data sent in such an instance will
result in the data being sent on the third leg of the SCTP four-way handshake.
Note that if the socket is a one-to-one type (SOCK_STREAM) socket then an
association must be in existence (by use of the
connect(2)
system call). Calling sctp_sendmsg () or
sctp_sendmsgx () on a non-connected one-to-one socket
will result in errno being set to
ENOTCONN , -1 being returned, and the message not being
transmitted.
The address of the target is given by to
with tolen specifying its size. The length of the
message msg is given by len. If
the message is too long to pass atomically through the underlying protocol,
errno is set to No indication of failure to deliver is implicit in a sctp_sendmsg(3) call. Locally detected errors are indicated by a return value of -1. If no space is available at the socket to hold the message to be transmitted, then sctp_sendmsg(3) normally blocks, unless the socket has been placed in non-blocking I/O mode. The select(2) system call may be used to determine when it is possible to send more data on one-to-one type (SOCK_STREAM) sockets. The ppid argument is an opaque 32 bit value that is passed transparently through the stack to the peer endpoint. It will be available on reception of a message (see sctp_recvmsg(3)). Note that the stack passes this value without regard to byte order. The flags argument may include one or more of the following: #define SCTP_EOF 0x0100 /* Start a shutdown procedures */ #define SCTP_ABORT 0x0200 /* Send an ABORT to peer */ #define SCTP_UNORDERED 0x0400 /* Message is un-ordered */ #define SCTP_ADDR_OVER 0x0800 /* Override the primary-address */ #define SCTP_SENDALL 0x1000 /* Send this on all associations */ /* for the endpoint */ /* The lower byte is an enumeration of PR-SCTP policies */ #define SCTP_PR_SCTP_TTL 0x0001 /* Time based PR-SCTP */ #define SCTP_PR_SCTP_BUF 0x0002 /* Buffer based PR-SCTP */ #define SCTP_PR_SCTP_RTX 0x0003 /* Number of retransmissions based PR-SCTP */ The flag
The flag For a one-to-many type (SOCK_SEQPACKET) socket the flag
The remaining flags are used for the partial reliability extension (RFC3758) and will only be effective if the peer endpoint supports this extension. This option specifies what local policy the local endpoint should use in skipping data. If none of these options are set, then data is never skipped over.
The The stream_no is the SCTP stream that you wish
to send the message on. Streams in SCTP are reliable (or partially reliable)
flows of ordered messages. The context field is used
only in the event the message cannot be sent. This is an opaque value that
the stack retains and will give to the user when a failed send is given if
that notification is enabled (see
sctp(4)).
Normally a user process can use this value to index some application
specific data structure when a send cannot be fulfilled.
RETURN VALUESThe call returns the number of characters sent, or -1 if an error occurred.ERRORSThesctp_sendmsg () system call fails if:
SEE ALSOconnect(2), getsockopt(2), recv(2), select(2), sendmsg(2), socket(2), write(2), sctp_connectx(3), sctp(4)BUGSBecause in the one-to-many style socketsctp_sendmsg ()
or sctp_sendmsgx () may have multiple associations
under one endpoint, a select on write will only work for a one-to-one style
socket.
Visit the GSP FreeBSD Man Page Interface. |