/// Accept a client connection and return a client stream
Accept a client connection and return a client stream
Accept a client connection and return a client stream
pub fn accept(&self) -> io::Result<VsockStream> {
        let mut addr: libc::sockaddr_vm = unsafe { std::mem::zeroed() };
        let mut addr_len = size_of::<libc::sockaddr_vm>() as libc::socklen_t;
        let cl_fd = unsafe {
            libc::accept(
                self.fd,
                &mut addr as *mut _ as *mut libc::sockaddr,
                &mut addr_len,
            )
        };
        if cl_fd < 0 {
            return Err(io::Error::last_os_error());
        }
        Ok(unsafe { VsockStream::from_raw_fd(cl_fd) })
    }
pub fn accept ( & self ) -> io :: Result < VsockStream > { let mut addr : libc :: sockaddr_vm = unsafe { std :: mem :: zeroed ( ) } ; let mut addr_len = size_of :: < libc :: sockaddr_vm > ( ) as libc :: socklen_t ; let cl_fd = unsafe { libc :: accept ( self . fd , & mut addr as * mut _ as * mut libc :: sockaddr , & mut addr_len , ) } ; if cl_fd < 0 { return Err ( io :: Error :: last_os_error ( ) ) ; } Ok ( unsafe { VsockStream :: from_raw_fd ( cl_fd ) } ) }
Accept a client connection and return a client stream
Accept a client connection and return a client stream
&self