|
NAMEsctp_recvmsg —
receive 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
DESCRIPTIONThesctp_recvmsg () system call is used to receive a
message from another SCTP endpoint. The sctp_recvmsg ()
call is used by one-to-one (SOCK_STREAM) type sockets after a successful
connect () call or after the application has performed
a listen () followed by a successful
accept (). For a one-to-many (SOCK_SEQPACKET) type
socket, an endpoint may call sctp_recvmsg () after
having implicitly started an association via one of the send calls including
sctp_sendmsg (), sendto () and
sendmsg (). Or, an application may also receive a
message after having called listen () with a positive
backlog to enable the reception of new associations.
The address of the sender is held in the
from argument with fromlen
specifying its size. At the completion of a successful
The length of the message msg to be received
is bounded by len. If the message is too long to fit
in the users receive buffer, then the flags argument
will not have the If no messages are available at the socket then
The sinfo argument is defined as follows. struct sctp_sndrcvinfo { uint16_t sinfo_stream; /* Stream arriving on */ uint16_t sinfo_ssn; /* Stream Sequence Number */ uint16_t sinfo_flags; /* Flags on the incoming message */ uint32_t sinfo_ppid; /* The ppid field */ uint32_t sinfo_context; /* context field */ uint32_t sinfo_timetolive; /* not used by sctp_recvmsg */ uint32_t sinfo_tsn; /* The transport sequence number */ uint32_t sinfo_cumtsn; /* The cumulative acknowledgment point */ sctp_assoc_t sinfo_assoc_id; /* The association id of the peer */ }; The sinfo->sinfo_ppid field is an opaque 32 bit value that is passed transparently through the stack from the peer endpoint. Note that the stack passes this value without regard to byte order. The sinfo->sinfo_flags field may include the following: #define SCTP_UNORDERED 0x0400 /* Message is un-ordered */ The The sinfo->sinfo_stream field is the SCTP stream that the message was received on. Streams in SCTP are reliable (or partially reliable) flows of ordered messages. The sinfo->sinfo_context field is used
only if the local application set an association level context with the
The sinfo->sinfo_ssn field will hold the stream sequence number assigned by the peer endpoint if the message is not unordered. For unordered messages this field holds an undefined value. The sinfo->sinfo_tsn field holds a transport sequence number (TSN) that was assigned to this message by the peer endpoint. For messages that fit in or less than the path MTU this will be the only TSN assigned. Note that for messages that span multiple TSNs this value will be one of the TSNs that was used on the message. The sinfo->sinfo_cumtsn field holds the current cumulative acknowledgment point of the transport association. Note that this may be larger or smaller than the TSN assigned to the message itself. The sinfo->sinfo_assoc_id is the unique association identification that was assigned to the association. For one-to-many (SOCK_SEQPACKET) type sockets this value can be used to send data to the peer without the use of an address field. It is also quite useful in setting various socket options on the specific association (see sctp(4)). The sinfo->info_timetolive field is not
used by RETURN VALUESThe call returns the number of bytes received, or -1 if an error occurred.ERRORSThesctp_recvmsg () system call fails if:
SEE ALSOgetsockopt(2), recv(2), select(2), sendmsg(2), setsockopt(2), socket(2), write(2), sctp_send(3), sctp_sendmsg(3), sctp(4)
Visit the GSP FreeBSD Man Page Interface. |