|
NAMEsctp_send , sctp_sendx —
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_send () system call is used to transmit a
message to another SCTP endpoint. sctp_send () may be
used to send data to an existing association for both one-to-many
(SOCK_SEQPACKET) and one-to-one (SOCK_STREAM) socket types. 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 EMSGSIZE , -1 is
returned, and the message is not transmitted.
No indication of failure to deliver is implicit in a
If no space is available at the socket to hold the message to be
transmitted, then The sinfo structure is used to control various SCTP features and has the following format: struct sctp_sndrcvinfo { uint16_t sinfo_stream; /* Stream sending to */ uint16_t sinfo_ssn; /* valid for recv only */ uint16_t sinfo_flags; /* flags to control sending */ uint32_t sinfo_ppid; /* ppid field */ uint32_t sinfo_context; /* context field */ uint32_t sinfo_timetolive; /* timetolive for PR-SCTP */ uint32_t sinfo_tsn; /* valid for recv only */ uint32_t sinfo_cumtsn; /* valid for recv only */ sctp_assoc_t sinfo_assoc_id; /* The association id */ }; The sinfo->sinfo_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 sinfo->sinfo_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 sinfo->sinfo_stream 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 sinfo->sinfo_assoc_id field is used to select the association to send to on a one-to-many socket. For a one-to-one socket, this field is ignored. The sinfo->sinfo_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. The flags argument holds the same meaning and values as those found in sendmsg(2) but is generally ignored by SCTP. The fields sinfo->sinfo_ssn,
sinfo->sinfo_tsn, and
sinfo->sinfo_cumtsn are used only when receiving
messages and are thus ignored by RETURN VALUESThe call returns the number of characters sent, or -1 if an error occurred.ERRORSThesctp_send () system call fails if:
SEE ALSOgetsockopt(2), recv(2), select(2), sendmsg(2), socket(2), write(2), sctp_connectx(3), sctp_recvmsg(3), sctp_sendmsg(3), sctp(4)BUGSBecausesctp_send () 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. |