Monday, February 20, 2012

recvmsg system call unix

The recvmsg(2) function is the natural counterpart to the sendmsg(2) function. The function
prototype for it is as follows:

#include <sys/types.h>
#include <sys/socket.h>
int recvmsg(int s, struct msghdr *msg, unsigned int flags);

The function arguments are as follows:
  • The socket s to receive a message from.
  • The message header structure pointer msg, which will control the operation of this function call.
  • The optional flag bits argument flags. These are the same flags that are valid for recv(2) or recvfrom(2) function calls.
The return value from this function is the number of bytes received. Otherwise, -1 indicates an error occurred and errno indicates the reason for it.

See Also:

No comments:

Post a Comment