Struct fuchsia_async::net::TcpListener
source · pub struct TcpListener(/* private fields */);
Expand description
An I/O object representing a TCP socket listening for incoming connections.
This object can be converted into a stream of incoming connections for various forms of processing.
Implementations§
source§impl TcpListener
impl TcpListener
sourcepub fn bind(addr: &SocketAddr) -> Result<TcpListener>
pub fn bind(addr: &SocketAddr) -> Result<TcpListener>
Creates a new TcpListener
bound to the provided socket.
sourcepub fn accept(self) -> Acceptor ⓘ
pub fn accept(self) -> Acceptor ⓘ
Consumes this listener and returns a Future
that resolves to an
io::Result<(TcpListener, TcpStream, SocketAddr)>
.
sourcepub fn accept_stream(self) -> AcceptStream
pub fn accept_stream(self) -> AcceptStream
Consumes this listener and returns a Stream
that resolves to elements
of type io::Result<(TcpStream, SocketAddr)>
.
sourcepub fn async_accept(
&mut self,
cx: &mut Context<'_>
) -> Poll<Result<(TcpStream, SocketAddr)>>
pub fn async_accept( &mut self, cx: &mut Context<'_> ) -> Poll<Result<(TcpStream, SocketAddr)>>
Poll on accept
ing a new TcpStream
from this listener.
This function is mainly intended for usage in manual Future
or Stream
implementations.
sourcepub fn from_std(listener: TcpListener) -> Result<TcpListener>
pub fn from_std(listener: TcpListener) -> Result<TcpListener>
Creates a new instance of fuchsia_async::net::TcpListener
from an
std::net::TcpListener
.
sourcepub fn std(&self) -> &TcpListener
pub fn std(&self) -> &TcpListener
Returns a reference to the underlying std::net::TcpListener
.
sourcepub fn local_addr(&self) -> Result<SocketAddr>
pub fn local_addr(&self) -> Result<SocketAddr>
Returns the local socket address of the listener.
Methods from Deref<Target = EventedFd<TcpListener>>§
sourcepub fn poll_readable(&self, cx: &mut Context<'_>) -> Poll<Result<(), Status>>
pub fn poll_readable(&self, cx: &mut Context<'_>) -> Poll<Result<(), Status>>
Tests to see if this resource is ready to be read from. If it is not, it arranges for the current task to receive a notification when a “readable” signal arrives.
sourcepub fn poll_writable(&self, cx: &mut Context<'_>) -> Poll<Result<(), Status>>
pub fn poll_writable(&self, cx: &mut Context<'_>) -> Poll<Result<(), Status>>
Tests to see if this resource is ready to be written to. If it is not, it arranges for the current task to receive a notification when a “writable” signal arrives.
pub fn as_ref(&self) -> &T
sourcepub fn need_read(&self, cx: &mut Context<'_>)
pub fn need_read(&self, cx: &mut Context<'_>)
Arranges for the current task to receive a notification when a “readable” signal arrives.
sourcepub fn need_write(&self, cx: &mut Context<'_>)
pub fn need_write(&self, cx: &mut Context<'_>)
Arranges for the current task to receive a notification when a “writable” signal arrives.