Trait virtual_net::VirtualTcpListener

source ·
pub trait VirtualTcpListener:
    VirtualIoSource
    + Debug
    + Send
    + Sync
    + 'static {
    // Required methods
    fn try_accept(
        &mut self,
    ) -> Result<(Box<dyn VirtualTcpSocket + Sync>, SocketAddr)>;
    fn set_handler(
        &mut self,
        handler: Box<dyn InterestHandler + Send + Sync>,
    ) -> Result<()>;
    fn addr_local(&self) -> Result<SocketAddr>;
    fn set_ttl(&mut self, ttl: u8) -> Result<()>;
    fn ttl(&self) -> Result<u8>;
}

Required Methods§

source

fn try_accept( &mut self, ) -> Result<(Box<dyn VirtualTcpSocket + Sync>, SocketAddr)>

Tries to accept a new connection

source

fn set_handler( &mut self, handler: Box<dyn InterestHandler + Send + Sync>, ) -> Result<()>

Registers a waker for when a new connection has arrived. This uses a stack machine which means more than one waker can be registered

source

fn addr_local(&self) -> Result<SocketAddr>

Returns the local address of this TCP listener

source

fn set_ttl(&mut self, ttl: u8) -> Result<()>

Sets how many network hops the packets are permitted for new connections

source

fn ttl(&self) -> Result<u8>

Returns the maximum number of network hops before packets are dropped

Implementors§