9.10 sctp_recvmsg Function
Just like sctp_sendmsg, the sctp_recvmsg function provides a more user-friendly interface to the advanced SCTP features. Using this function allows a user to retrieve not only its peer's address, but also the msg_flags field that would normally accompany the recvmsg function call (e.g., MSG_NOTIFICATION, MSG_EOR, etc.). The function also allows the user to retrieve the sctp_sndrcvinfo structure that accompanies the message that was read into the message buffer. Note that if an application wishes to receive sctp_sndrcvinfo information, the sctp_data_io_event must be subscribed to with the SCTP_EVENTS socket option (ON by default). The sctp_recvmsg function takes the following form:
ssize_t sctp_recvmsg(int sockfd , void *msg , size_t msgsz , struct sockaddr *from , socklen_t *fromlen , struct sctp_sndrcvinfo *sinfo , int *msg_flags ); |
Returns: the number of bytes read, 1 on error |