Struct kernel::net::TcpListener
source · [−]pub struct TcpListener { /* private fields */ }
Expand description
Implementations
sourceimpl TcpListener
impl TcpListener
sourcepub fn try_new(ns: &Namespace, addr: &SocketAddr) -> Result<Self>
pub fn try_new(ns: &Namespace, addr: &SocketAddr) -> Result<Self>
Creates a new TCP listener.
It is configured to listen on the given socket address for the given namespace.
sourcepub fn accept(&self, block: bool) -> Result<TcpStream>
pub fn accept(&self, block: bool) -> Result<TcpStream>
Accepts a new connection.
On success, returns the newly-accepted socket stream.
If no connection is available to be accepted, one of two behaviours will occur:
- If
block
isfalse
, returnscrate::error::code::EAGAIN
; - If
block
istrue
, blocks until an error occurs or some connection can be accepted.
Trait Implementations
Auto Trait Implementations
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more