pub fn recvmmsg<'a, I, S>(
    fd: i32,
    data: impl IntoIterator<Item = &'a mut RecvMmsgData<'a, I>, IntoIter = impl ExactSizeIterator<Item = &'a mut RecvMmsgData<'a, I>> + Iterator>,
    flags: MsgFlags,
    timeout: Option<TimeSpec>
) -> Result<Vec<RecvMsg<'a, S>, Global>, Errno> where
    I: 'a + AsRef<[IoSliceMut<'a>]>,
    S: 'a + Copy + SockaddrLike
Expand description

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 descriptor
  • data: Struct that implements IntoIterator with RecvMmsgData items
  • flags: Optional flags passed directly to the operating system.

RecvMmsgData

  • iov: Scatter-gather list of buffers to receive the message
  • cmsg_buffer: Space to receive ancillary data. Should be created by cmsg_space!

Returns

A Vec with multiple RecvMsg, one per received message

References