Struct UnixSeqpacketConn

Source
pub struct UnixSeqpacketConn { /* private fields */ }
Expand description

An I/O object representing a Unix Sequenced-packet socket.

Implementations§

Source§

impl UnixSeqpacketConn

Source

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.

Source

pub fn connect_addr(addr: &UnixSocketAddr) -> Result<Self>

Connects to an unix seqpacket server listening at addr.

Source

pub fn connect_from_addr( from: &UnixSocketAddr, to: &UnixSocketAddr, ) -> Result<Self>

Binds to an address before connecting to a listening seqpacet socket.

Source

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.

Source

pub fn from_nonblocking(conn: UnixSeqpacketConn) -> Result<Self, Error>

Creates a tokio-compatible socket from an existing nonblocking socket.

Source

pub fn into_nonblocking(self) -> UnixSeqpacketConn

Deregisters the connection and returns the underlying non-blocking type.

Source

pub unsafe fn from_raw_fd(fd: RawFd) -> Result<Self, Error>

Creates a tokio-compatible socket from a raw file descriptor.

This function is provided instead of implementing FromRawFd because registering with the reactor might fail.

§Safety

The file descriptor must represent a connected seqpacket socket.

Source

pub fn shutdown(&self, how: Shutdown) -> Result<(), Error>

Shuts down the read, write, or both halves of this connection.

Source

pub fn local_addr(&self) -> Result<UnixSocketAddr, Error>

Returns the address of this side of the connection.

Source

pub fn peer_addr(&self) -> Result<UnixSocketAddr, Error>

Returns the address of the other side of the connection.

Source

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.

Source

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

pub fn take_error(&self) -> Result<Option<Error>, Error>

Returns the value of the SO_ERROR option.

Source§

impl UnixSeqpacketConn

Source

pub async fn send(&mut self, packet: &[u8]) -> Result<usize>

Sends a packet to the socket’s peer.

Source

pub async fn recv(&mut self, buffer: &mut [u8]) -> Result<usize>

Receives a packet from the socket’s peer.

Source

pub async fn send_vectored<'a, 'b>( &'a mut self, slices: &'b [IoSlice<'b>], ) -> Result<usize>

Sends a packet assembled from multiple byte slices.

Source

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.

Source

pub async fn peek(&mut self, buffer: &mut [u8]) -> Result<usize>

Receives a packet without removing it from the incoming queue.

Source

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.

Source

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

Sends a packet with associated file descriptors.

Source

pub async fn recv_fds( &mut self, byte_buffer: &mut [u8], fd_buffer: &mut [RawFd], ) -> Result<(usize, bool, usize)>

Receives a packet and associated file descriptors.

Trait Implementations§

Source§

impl AsRawFd for UnixSeqpacketConn

Source§

fn as_raw_fd(&self) -> RawFd

Extracts the raw file descriptor. Read more
Source§

impl AsRef<NonblockingUnixSeqpacketConn> for UnixSeqpacketConn

Source§

fn as_ref(&self) -> &UnixSeqpacketConn

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl IntoRawFd for UnixSeqpacketConn

Source§

fn into_raw_fd(self) -> RawFd

Consumes this object, returning the raw underlying file descriptor. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.