pub struct TcpListener { /* private fields */ }Expand description
An asynchronous TcpListener based on mio library.
Implementations§
Source§impl TcpListener
impl TcpListener
Sourcepub fn mio_socket(&self) -> &TcpListener
pub fn mio_socket(&self) -> &TcpListener
Returns the immutable reference to the inner mio socket.
Sourcepub async fn bind(addr: SocketAddr) -> Result<Self>
Available on crate feature global_reactor only.
pub async fn bind(addr: SocketAddr) -> Result<Self>
global_reactor only.See bind_with
Sourcepub async fn bind_with(addr: SocketAddr, reactor: Reactor) -> Result<Self>
pub async fn bind_with(addr: SocketAddr, reactor: Reactor) -> Result<Self>
Convenience method to bind a new TCP listener to the specified address to receive new connections.
Sourcepub async fn accept(&self) -> Result<(TcpStream, SocketAddr)>
pub async fn accept(&self) -> Result<(TcpStream, SocketAddr)>
Accepts a new TcpStream.
If an accepted stream is returned, the remote address of the peer is returned along with it.
Trait Implementations§
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