1SENDMMSG(2)                Linux Programmer's Manual               SENDMMSG(2)
2
3
4

NAME

6       sendmmsg - send multiple messages on a socket
7

SYNOPSIS

9       #define _GNU_SOURCE
10       #include <sys/socket.h>
11
12       int sendmmsg(int sockfd, struct mmsghdr *msgvec, unsigned int vlen,
13                    unsigned int flags);
14

DESCRIPTION

16       The  sendmmsg()  system  call is an extension of sendmsg(2) that allows
17       the caller to transmit multiple messages on a  socket  using  a  single
18       system call.  (This has performance benefits for some applications.)
19
20       The  sockfd argument is the file descriptor of the socket on which data
21       is to be transmitted.
22
23       The msgvec argument is a pointer to an  array  of  mmsghdr  structures.
24       The size of this array is specified in vlen.
25
26       The mmsghdr structure is defined in <sys/socket.h> as:
27
28           struct mmsghdr {
29               struct msghdr msg_hdr;  /* Message header */
30               unsigned int  msg_len;  /* Number of bytes transmitted */
31           };
32
33       The  msg_hdr  field  is a msghdr structure, as described in sendmsg(2).
34       The msg_len field is used to return the number of bytes sent  from  the
35       message  in  msg_hdr  (i.e., the same as the return value from a single
36       sendmsg(2) call).
37
38       The flags argument contains flags ORed together.   The  flags  are  the
39       same as for sendmsg(2).
40
41       A  blocking  sendmmsg() call blocks until vlen messages have been sent.
42       A nonblocking call sends as many messages as possible (up to the  limit
43       specified by vlen) and returns immediately.
44
45       On return from sendmmsg(), the msg_len fields of successive elements of
46       msgvec are updated to contain the number of bytes transmitted from  the
47       corresponding msg_hdr.  The return value of the call indicates the num‐
48       ber of elements of msgvec that have been updated.
49

RETURN VALUE

51       On success, sendmmsg() returns the number of messages sent from msgvec;
52       if  this  is  less than vlen, the caller can retry with a further send‐
53       mmsg() call to send the remaining messages.
54
55       On error, -1 is returned, and errno is set to indicate the error.
56

ERRORS

58       Errors are as for sendmsg(2).  An error is returned only  if  no  data‐
59       grams could be sent.
60

VERSIONS

62       The  sendmmsg()  system  call was added in Linux 3.0.  Support in glibc
63       was added in version 2.14.
64

CONFORMING TO

66       sendmmsg() is Linux-specific.
67

NOTES

69       The value specified in vlen is capped to UIO_MAXIOV (1024).
70

SEE ALSO

72       recvmmsg(2), sendmsg(2), socket(2), socket(7)
73
74
75
76Linux                             2011-09-09                       SENDMMSG(2)
Impressum