9.10 sctp_recvmsg Function


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

On return from this call, msg is filled with up to msgsz bytes of data. The message sender's address is contained in from , with the address size filled in the fromlen argument. Any message flags will be contained in the msg_flags argument. If the notification sctp_data_io_event has been enabled (the default), the sctp_sndrcvinfo structure will be filled in with detailed information about the message as well. Note that if an implementation maps the sctp_recvmsg to a recvmsg function call, the flags field of the call will be set to 0.



UNIX Network Programming Volume 1, Third Edition
Unix Network Programming, Volume 1: The Sockets Networking API (3rd Edition)
ISBN: 0131411551
EAN: 2147483647
Year: 2003
Pages: 441

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net