Function nix::sys::socket::recvmmsg
pub fn recvmmsg<'a, I>(fd: RawFd, data: impl std::iter::IntoIterator<Item = &'a mut RecvMmsgData<'a, I>, IntoIter = impl ExactSizeIterator + Iterator<Item = &'a mut RecvMmsgData<'a, I>>>, flags: MsgFlags, timeout: Option<crate::sys::time::TimeSpec>) -> Result<Vec<RecvMsg<'a>>>
where
I: AsRef<[IoVec<&'a mut [u8]>]> + 'a,
The portability is definied by:
#[cfg(any(target_os = "linux", target_os = "android", target_os = "freebsd",
target_os = "netbsd",))]
Documentation
An extension of recvmsg
that allows the caller to receive multiple
messages from a socket using a single system call. This has
performance benefits for some applications.
iov
and cmsg_buffer
should be constructed similarly to recvmsg
Multiple allocations are performed
Arguments
fd
: Socket file descriptordata
: Struct that implementsIntoIterator
withRecvMmsgData
itemsflags
: Optional flags passed directly to the operating system.
RecvMmsgData
iov
: Scatter-gather list of buffers to receive the messagecmsg_buffer
: Space to receive ancillary data. Should be created bycmsg_space!
Returns
A Vec
with multiple RecvMsg
, one per received message