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§
sourcefn try_accept(
&mut self,
) -> Result<(Box<dyn VirtualTcpSocket + Sync>, SocketAddr)>
fn try_accept( &mut self, ) -> Result<(Box<dyn VirtualTcpSocket + Sync>, SocketAddr)>
Tries to accept a new connection
sourcefn set_handler(
&mut self,
handler: Box<dyn InterestHandler + Send + Sync>,
) -> Result<()>
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
sourcefn addr_local(&self) -> Result<SocketAddr>
fn addr_local(&self) -> Result<SocketAddr>
Returns the local address of this TCP listener
Implementors§
impl VirtualTcpListener for CompositeTcpListener
impl VirtualTcpListener for LocalTcpListener
Available on crate feature
host-net
only.