Receiving multiple datagrams in a single system call Receiving multiple datagrams in a single system call linux linux

Receiving multiple datagrams in a single system call


Use recvmmsg to receive multiple datagram packets (example UDP)

int recvmmsg(int sockfd, struct mmsghdr *msgvec, unsigned int vlen,                    unsigned int flags, struct timespec *timeout);DESCRIPTION            The recvmmsg() system call is an extension of recvmsg(2) that allows   the caller to receive multiple messages from a socket using a single   system call. ...

http://man7.org/linux/man-pages/man2/recvmmsg.2.html

Use sendmmsg to send...

int sendmmsg(int sockfd, struct mmsghdr *msgvec, unsigned int vlen,                    unsigned int flags);DESCRIPTION           The sendmmsg() system call is an extension of sendmsg(2) that allows   the caller to transmit multiple messages on a socket using a single   system call.

http://man7.org/linux/man-pages/man2/sendmmsg.2.html


There is no such call on Linux. However, depending what you need, there are alternatives: