pub struct UnixSeqpacketConn { /* private fields */ }
Expand description
An I/O object representing a Unix Sequenced-packet socket.
Implementations§
Source§impl UnixSeqpacketConn
impl UnixSeqpacketConn
Sourcepub fn connect<P: AsRef<Path>>(path: P) -> Result<Self>
pub fn connect<P: AsRef<Path>>(path: P) -> Result<Self>
Connects to the socket named by path.
This function will create a new Unix socket and connects to the path specified, associating the returned stream with the default event loop’s handle.
Sourcepub fn connect_addr(addr: &UnixSocketAddr) -> Result<Self>
pub fn connect_addr(addr: &UnixSocketAddr) -> Result<Self>
Connects to an unix seqpacket server listening at addr
.
Sourcepub fn connect_from_addr(
from: &UnixSocketAddr,
to: &UnixSocketAddr,
) -> Result<Self>
pub fn connect_from_addr( from: &UnixSocketAddr, to: &UnixSocketAddr, ) -> Result<Self>
Binds to an address before connecting to a listening seqpacet socket.
Sourcepub fn pair() -> Result<(UnixSeqpacketConn, UnixSeqpacketConn), Error>
pub fn pair() -> Result<(UnixSeqpacketConn, UnixSeqpacketConn), Error>
Creates an unnamed pair of connected sockets.
This function will create a pair of interconnected Unix sockets for communicating back and forth between one another. Each socket will be associated with the default event loop’s handle.
Sourcepub fn from_nonblocking(conn: UnixSeqpacketConn) -> Result<Self, Error>
pub fn from_nonblocking(conn: UnixSeqpacketConn) -> Result<Self, Error>
Creates a tokio-compatible socket from an existing nonblocking socket.
Sourcepub fn into_nonblocking(self) -> UnixSeqpacketConn
pub fn into_nonblocking(self) -> UnixSeqpacketConn
Deregisters the connection and returns the underlying non-blocking type.
Sourcepub unsafe fn from_raw_fd(fd: RawFd) -> Result<Self, Error>
pub unsafe fn from_raw_fd(fd: RawFd) -> Result<Self, Error>
Sourcepub fn shutdown(&self, how: Shutdown) -> Result<(), Error>
pub fn shutdown(&self, how: Shutdown) -> Result<(), Error>
Shuts down the read, write, or both halves of this connection.
Sourcepub fn local_addr(&self) -> Result<UnixSocketAddr, Error>
pub fn local_addr(&self) -> Result<UnixSocketAddr, Error>
Returns the address of this side of the connection.
Sourcepub fn peer_addr(&self) -> Result<UnixSocketAddr, Error>
pub fn peer_addr(&self) -> Result<UnixSocketAddr, Error>
Returns the address of the other side of the connection.
Sourcepub fn initial_peer_credentials(&self) -> Result<ConnCredentials, Error>
pub fn initial_peer_credentials(&self) -> Result<ConnCredentials, Error>
Returns information about the process of the peer when the connection was established.
See documentation of the returned type for details.
Sourcepub fn initial_peer_selinux_context(
&self,
buffer: &mut [u8],
) -> Result<usize, Error>
pub fn initial_peer_selinux_context( &self, buffer: &mut [u8], ) -> Result<usize, Error>
Returns the SELinux security context of the process that created the other end of this connection.
Will return an error on other operating systems than Linux or Android,
and also if running inside kubernetes.
On success the number of bytes used is returned. (like Read
)
The default security context is unconfined
, without any trailing NUL.
A buffor of 50 bytes is probably always big enough.
Source§impl UnixSeqpacketConn
impl UnixSeqpacketConn
Sourcepub async fn send(&mut self, packet: &[u8]) -> Result<usize>
pub async fn send(&mut self, packet: &[u8]) -> Result<usize>
Sends a packet to the socket’s peer.
Sourcepub async fn recv(&mut self, buffer: &mut [u8]) -> Result<usize>
pub async fn recv(&mut self, buffer: &mut [u8]) -> Result<usize>
Receives a packet from the socket’s peer.
Sourcepub async fn send_vectored<'a, 'b>(
&'a mut self,
slices: &'b [IoSlice<'b>],
) -> Result<usize>
pub async fn send_vectored<'a, 'b>( &'a mut self, slices: &'b [IoSlice<'b>], ) -> Result<usize>
Sends a packet assembled from multiple byte slices.
Sourcepub async fn recv_vectored<'a, 'b>(
&'a mut self,
buffers: &'b mut [IoSliceMut<'b>],
) -> Result<usize>
pub async fn recv_vectored<'a, 'b>( &'a mut self, buffers: &'b mut [IoSliceMut<'b>], ) -> Result<usize>
Receives a packet and places the bytes across multiple buffers.
Sourcepub async fn peek(&mut self, buffer: &mut [u8]) -> Result<usize>
pub async fn peek(&mut self, buffer: &mut [u8]) -> Result<usize>
Receives a packet without removing it from the incoming queue.
Sourcepub async fn peek_vectored<'a, 'b>(
&'a mut self,
buffers: &'b mut [IoSliceMut<'b>],
) -> Result<usize>
pub async fn peek_vectored<'a, 'b>( &'a mut self, buffers: &'b mut [IoSliceMut<'b>], ) -> Result<usize>
Reads a packet into multiple buffers without removing it from the incoming queue.