On Linux, unless I'm mistaken, an application can use the socket call family to send or receive one packet at a time on datagram transports.
Would like to know if Linux provides a means for the application to send and receive multiple packets in a single call on datagram transports.
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With