sctp_recvmsg() Function
ssize_t sctp_recvmsg(s, *msg, len, *from, *fromlen, *sinfo, *msg_flags);
int s, void *msg, size_t len, struct sockaddr *from, socklen_t *fromlen, struct sctp_sndrcvinfo *sinfo, int *msg_flags;The sctp_recvmsg() function enables receipt of a message from the SCTP endpoint specified by the s parameter. The calling program can specify the following attributes:
-
msg -
This parameter is the address of the message buffer.
-
len -
This parameter is the length of the message buffer.
-
from -
This parameter is a pointer to an address that contains the sender's address.
-
fromlen -
This parameter is the size of the buffer associated with the address in the
fromparameter. -
sinfo -
This parameter is only active if the calling program enables
sctp_data_io_events. To enablesctp_data_io_events, call thesetsockopt() function with the socket optionSCTP_EVENTS. Whensctp_data_io_eventsis enabled, the application receives the contents of thesctp_sndrcvinfostructure for each incoming message. This parameter is a pointer to asctp_sndrcvinfostructure. The structure is populated upon receipt of the message. -
msg_flags -
This parameter contains any message flags that are present.
The sctp_recvmsg() function returns the number of bytes it receives. The sctp_recvmsg() function returns -1 when an error occurs.
If the file descriptor passed in the s parameter is not valid, the sctp_recvmsg() function fails and sets the value of errno to EBADF. If the file descriptor passed in the s parameter does not describe a socket, the sctp_recvmsg() function fails and sets the value of errno to ENOTSOCK. If the msg_flags parameter includes the value MSG_OOB, the sctp_recvmsg() function fails and sets the value of errno to EOPNOTSUPP. If there is no established association, the sctp_recvmsg() function fails and sets the value of errno to ENOTCONN.