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

pub trait SocketTap {
    fn connect(&mut self, timeout: Option<Duration>) -> CDnsResult<()>;
fn is_tcp(&self) -> bool;
fn is_conncected(&self) -> bool;
fn get_pollfd(&self) -> PollFd;
fn get_remote_addr(&self) -> &SocketAddr;
fn send(&mut self, sndbuf: &[u8]) -> CDnsResult<usize>;
fn recv(&mut self, rcvbuf: &mut [u8]) -> CDnsResult<usize>; }
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 PollFd. Will panic! if instance was initialized in blocking mode.

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