pub fn recv_header(&mut self) -> Result<(MsgHeader, Option<Vec<File>>)> {
        let mut hdr = MsgHeader::default();
        let mut iovs = [iovec {
            iov_base: (&mut hdr as *mut MsgHeader) as *mut c_void,
            iov_len: mem::size_of::<MsgHeader>(),
        }];
        // Safe because we own hdr and it's ByteValued.
        let (bytes, files) = unsafe { self.recv_into_iovec_all(&mut iovs[..])? };

        if bytes != mem::size_of::<MsgHeader>() {
            return Err(Error::PartialMessage);
        } else if !hdr.is_valid() {
            return Err(Error::InvalidMessage);
        }

        Ok((hdr, files))
    }
/// Receive a header-only message with optional attached files.
/// Note, only the first MAX_ATTACHED_FD_ENTRIES file descriptors will be
/// accepted and all other file descriptor will be discard silently.
///
/// # Return:
/// * - (message header, [received files]) on success.
/// * - SocketRetry: temporary error caused by signals or short of resources.
/// * - SocketBroken: the underline socket is broken.
/// * - SocketError: other socket related errors.
/// * - PartialMessage: received a partial message.
/// * - InvalidMessage: received a invalid message.
Receive a header-only message with optional attached files.
Note, only the first MAX_ATTACHED_FD_ENTRIES file descriptors will be
accepted and all other file descriptor will be discard silently.
Receive a header - only message with optional attached files . Note only the first MAX_ATTACHED_FD_ENTRIES file descriptors will be accepted and all other file descriptor will be discard silently .
pub fn recv_header(&mut self) -> Result<(MsgHeader, Option<Vec<File>>)> {
        let mut hdr = MsgHeader::default();
        let mut iovs = [iovec {
            iov_base: (&mut hdr as *mut MsgHeader) as *mut c_void,
            iov_len: mem::size_of::<MsgHeader>(),
        }];
        // Safe because we own hdr and it's ByteValued.
        let (bytes, files) = unsafe { self.recv_into_iovec_all(&mut iovs[..])? };
        if bytes != mem::size_of::<MsgHeader>() {
            return Err(Error::PartialMessage);
        } else if !hdr.is_valid() {
            return Err(Error::InvalidMessage);
        }
        Ok((hdr, files))
    }
pub fn recv_header ( & mut self ) -> Result < ( MsgHeader , Option < Vec < File > > ) > { let mut hdr = MsgHeader :: default ( ) ; let mut iovs = [ iovec { iov_base : ( & mut hdr as * mut MsgHeader ) as * mut c_void , iov_len : mem :: size_of :: < MsgHeader > ( ) , } ] ; // Safe because we own hdr and it's ByteValued. let ( bytes , files ) = unsafe { self . recv_into_iovec_all ( & mut iovs [ .. ] ) ? } ; if bytes != mem :: size_of :: < MsgHeader > ( ) { return Err ( Error :: PartialMessage ) ; } else if ! hdr . is_valid ( ) { return Err ( Error :: InvalidMessage ) ; } Ok ( ( hdr , files ) ) }
Receive a header-only message with optional attached files.
Receive a header - only message with optional attached files .
&mut self
&mut self
return:
- (message header, [received files]) on success.
- SocketRetry: temporary error caused by signals or short of resources.
- SocketBroken: the underline socket is broken.
- SocketError: other socket related errors.
- PartialMessage: received a partial message.
- InvalidMessage: received a invalid message.
- ( message header [ received files ] ) on success . - SocketRetry : temporary error caused by signals or short of resources . - SocketBroken : the underline socket is broken . - SocketError : other socket related errors . - PartialMessage : received a partial message . - InvalidMessage : received a invalid message .