Trait cdns_rs::a_sync::network::SocketTap[][src]

pub trait SocketTap {
    fn connect<'life0, 'async_trait>(
        &'life0 mut self
    ) -> Pin<Box<dyn Future<Output = CDnsResult<()>> + Send + 'async_trait>>
    where
        'life0: 'async_trait,
        Self: 'async_trait
;
fn is_tcp(&self) -> bool;
fn is_conncected<'life0, 'async_trait>(
        &'life0 self
    ) -> Pin<Box<dyn Future<Output = bool> + Send + 'async_trait>>
    where
        'life0: 'async_trait,
        Self: 'async_trait
;
fn get_remote_addr(&self) -> &SocketAddr;
fn send<'life0, 'life1, 'async_trait>(
        &'life0 mut self,
        sndbuf: &'life1 [u8]
    ) -> Pin<Box<dyn Future<Output = CDnsResult<usize>> + Send + 'async_trait>>
    where
        'life0: 'async_trait,
        'life1: 'async_trait,
        Self: 'async_trait
;
fn recv<'life0, 'life1, 'async_trait>(
        &'life0 mut self,
        rcvbuf: &'life1 mut [u8]
    ) -> Pin<Box<dyn Future<Output = CDnsResult<usize>> + Send + 'async_trait>>
    where
        'life0: 'async_trait,
        'life1: 'async_trait,
        Self: 'async_trait
; }
Expand description

A common interface to access the realizations for both TcpStream and UdpSocket

Required methods

Connects to the remote host.
If timeout is not set, the socket is initialized in non blocking mode and [PollFd] is created to use with poll(2).
If timeout is set, then the socket is initialized in blocking mode with timeout. Tht [PollFd] is not generated!

Tells if current instance is TcpStream if true, or UdpSocket if false

Tells if socket/stream is connected to remote host

Returns the remote host Ip and port.

Sends data over wire.

Receives data transmitted from remote host. In nonblocking mode it should be called only after the event was polled In blocking mode it will block until received or timeout.

Trait Implementations

Formats the value using the given formatter. Read more

Implementors