[−][src]Trait sys_util::ScmSocket
Trait for file descriptors can send and receive socket control messages via sendmsg
and
recvmsg
.
Required methods
Loading content...Provided methods
fn send_with_fd<D: IntoIovec>(&self, buf: D, fd: RawFd) -> Result<usize>
Sends the given data and file descriptor over the socket.
On success, returns the number of bytes sent.
Arguments
buf
- A buffer of data to send on thesocket
.fd
- A file descriptors to be sent.
fn send_with_fds<D: IntoIovec>(&self, buf: D, fd: &[RawFd]) -> Result<usize>
Sends the given data and file descriptors over the socket.
On success, returns the number of bytes sent.
Arguments
buf
- A buffer of data to send on thesocket
.fds
- A list of file descriptors to be sent.
fn recv_with_fd(&self, buf: &mut [u8]) -> Result<(usize, Option<File>)>
Receives data and potentially a file descriptor from the socket.
On success, returns the number of bytes and an optional file descriptor.
Arguments
buf
- A buffer to receive data from the socket.vm
fn recv_with_fds(
&self,
buf: &mut [u8],
fds: &mut [RawFd]
) -> Result<(usize, usize)>
&self,
buf: &mut [u8],
fds: &mut [RawFd]
) -> Result<(usize, usize)>
Receives data and file descriptors from the socket.
On success, returns the number of bytes and file descriptors received as a tuple
(bytes count, files count)
.
Arguments
buf
- A buffer to receive data from the socket.fds
- A slice ofRawFd
s to put the received file descriptors into. On success, the number of valid file descriptors is indicated by the second element of the returned tuple. The caller owns these file descriptors, but they will not be closed on drop like aFile
-like type would be. It is recommended that each valid file descriptor gets wrapped in a drop type that closes it after this returns.
Implementations on Foreign Types
impl ScmSocket for UnixDatagram
[src]
fn socket_fd(&self) -> RawFd
[src]
fn send_with_fd<D: IntoIovec>(&self, buf: D, fd: RawFd) -> Result<usize>
[src]
fn send_with_fds<D: IntoIovec>(&self, buf: D, fd: &[RawFd]) -> Result<usize>
[src]
fn recv_with_fd(&self, buf: &mut [u8]) -> Result<(usize, Option<File>)>
[src]
fn recv_with_fds(
&self,
buf: &mut [u8],
fds: &mut [RawFd]
) -> Result<(usize, usize)>
[src]
&self,
buf: &mut [u8],
fds: &mut [RawFd]
) -> Result<(usize, usize)>
impl ScmSocket for UnixStream
[src]
fn socket_fd(&self) -> RawFd
[src]
fn send_with_fd<D: IntoIovec>(&self, buf: D, fd: RawFd) -> Result<usize>
[src]
fn send_with_fds<D: IntoIovec>(&self, buf: D, fd: &[RawFd]) -> Result<usize>
[src]
fn recv_with_fd(&self, buf: &mut [u8]) -> Result<(usize, Option<File>)>
[src]
fn recv_with_fds(
&self,
buf: &mut [u8],
fds: &mut [RawFd]
) -> Result<(usize, usize)>
[src]
&self,
buf: &mut [u8],
fds: &mut [RawFd]
) -> Result<(usize, usize)>