sendfd

Trait RecvWithFd

Source
pub trait RecvWithFd {
    // Required method
    fn recv_with_fd(
        &self,
        bytes: &mut [u8],
        fds: &mut [RawFd],
    ) -> Result<(usize, usize)>;
}
Expand description

An extension trait that enables receiving associated file descriptors along with the data.

Required Methods§

Source

fn recv_with_fd( &self, bytes: &mut [u8], fds: &mut [RawFd], ) -> Result<(usize, usize)>

Receive the bytes and the file descriptors.

The bytes and the file descriptors are received into the corresponding buffers.

Implementations on Foreign Types§

Source§

impl RecvWithFd for UnixDatagram

Source§

fn recv_with_fd( &self, bytes: &mut [u8], fds: &mut [RawFd], ) -> Result<(usize, usize)>

Receive the bytes and the file descriptors as a single packet.

It is guaranteed that the received information will form a single coherent packet, and data received will match a corresponding send_with_fd call. Note, however, that in case the receiving buffer(s) are to small, the message may get silently truncated and the undelivered data will be discarded.

For receiving the file descriptors, the internal buffer is sized according to the size of the fds buffer. If the sender sends fds.len() descriptors, but prefaces the descriptors with some other ancilliary data, then some file descriptors may be truncated as well.

Source§

impl RecvWithFd for ReadHalf<'_>

Source§

fn recv_with_fd( &self, bytes: &mut [u8], fds: &mut [RawFd], ) -> Result<(usize, usize)>

Receive the bytes and the file descriptors from the stream.

It is not guaranteed that the received information will form a single coherent packet of data. In other words, it is not required that this receives the bytes and file descriptors that were sent with a single send_with_fd call by somebody else.

Source§

impl RecvWithFd for UnixStream

Source§

fn recv_with_fd( &self, bytes: &mut [u8], fds: &mut [RawFd], ) -> Result<(usize, usize)>

Receive the bytes and the file descriptors from the stream.

It is not guaranteed that the received information will form a single coherent packet of data. In other words, it is not required that this receives the bytes and file descriptors that were sent with a single send_with_fd call by somebody else.

Source§

impl RecvWithFd for UnixDatagram

Source§

fn recv_with_fd( &self, bytes: &mut [u8], fds: &mut [RawFd], ) -> Result<(usize, usize)>

Receive the bytes and the file descriptors as a single packet.

It is guaranteed that the received information will form a single coherent packet, and data received will match a corresponding send_with_fd call. Note, however, that in case the receiving buffer(s) are to small, the message may get silently truncated and the undelivered data will be discarded.

For receiving the file descriptors, the internal buffer is sized according to the size of the fds buffer. If the sender sends fds.len() descriptors, but prefaces the descriptors with some other ancilliary data, then some file descriptors may be truncated as well.

Source§

impl RecvWithFd for UnixStream

Source§

fn recv_with_fd( &self, bytes: &mut [u8], fds: &mut [RawFd], ) -> Result<(usize, usize)>

Receive the bytes and the file descriptors from the stream.

It is not guaranteed that the received information will form a single coherent packet of data. In other words, it is not required that this receives the bytes and file descriptors that were sent with a single send_with_fd call by somebody else.

Implementors§