You are here : Csys/socket.hrecvmsg

recvmsg() - sys/socket.h

recvmsg - receive a message from a socket.
The recvmsg() function receives a message from a connection-mode or connectionless-mode socket. It is normally used with connectionless-mode sockets because it permits the application to retrieve the source address of received data.


Syntax

#include <sys/socket.h>

ssize_t recvmsg(int socket, struct msghdr *message, int flags);


Example


Output / Return Value

Upon successful completion, recvmsg() returns the length of the message in bytes. If no messages are available to be received and the peer has performed an orderly shutdown, recvmsg() returns 0. Otherwise, -1 is returned and errno is set to indicate the error.


Limitations


Alternatives / See Also


Reference