pub struct TcpListener { /* private fields */ }
Expand description
A structure representing a socket tcp server
Implementations§
Source§impl TcpListener
impl TcpListener
Sourcepub fn bind<S: ToSocketAddrs>(laddrs: S) -> Result<Self>
pub fn bind<S: ToSocketAddrs>(laddrs: S) -> Result<Self>
Create new tcp listener with calling underly bind method.
Sourcepub async fn accept(&self) -> Result<(TcpStream, SocketAddr)>
pub async fn accept(&self) -> Result<(TcpStream, SocketAddr)>
Accepts a new incoming connection from this listener.
Sourcepub async fn accept_with(
&self,
poller: Handle,
) -> Result<(TcpStream, SocketAddr)>
pub async fn accept_with( &self, poller: Handle, ) -> Result<(TcpStream, SocketAddr)>
Accepts a new incoming connection with providing poller
Sourcepub fn local_addr(&self) -> Result<SocketAddr>
pub fn local_addr(&self) -> Result<SocketAddr>
Returns the local socket address of this listener.
Trait Implementations§
Source§impl Debug for TcpListener
impl Debug for TcpListener
Auto Trait Implementations§
impl Freeze for TcpListener
impl RefUnwindSafe for TcpListener
impl Send for TcpListener
impl Sync for TcpListener
impl Unpin for TcpListener
impl UnwindSafe for TcpListener
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more