[][src]Struct fumio::net::TcpListener

#[must_use = "A TCP listener does nothing if not actually used"]
pub struct TcpListener { /* fields omitted */ }

A TCP listening socket.

Methods

impl TcpListener[src]

pub fn default_builder_for(local: &SocketAddr) -> Result<TcpBuilder, Error>[src]

Create builder with default options, but doesn't bind yet.

To create a TcpListener from a builder go through the std::net::TcpListener created by builder.listen(...)?.

pub fn bind_port(port: u16) -> Result<TcpListener, Error>[src]

Binds a new listener to IPv6 [::] with V6_ONLY=false (i.e. also listen on IPv4) to the given port.

If the port is 0 the OS will select a random port.

pub fn bind_ipv4_port(port: u16) -> Result<TcpListener, Error>[src]

Binds a new listener to IPv4 0.0.0.0 to the given port.

If the port is 0 the OS will select a random port.

pub fn bind(local: SocketAddr) -> Result<TcpListener, Error>[src]

Bind a new listener to the specified address

Uses default_builder_for(addr) to construct a builder, binds the address and listens with a backlog of up to 1024 connections.

pub fn bind_with(
    local: SocketAddr,
    handle: LazyHandle
) -> Result<TcpListener, Error>
[src]

Bind a new listener to the specified address

Uses default_builder_for(addr) to construct a builder, binds the address and listens with a backlog of up to 1024 connections.

pub fn from_std(
    listener: TcpListener,
    handle: LazyHandle
) -> Result<TcpListener, Error>
[src]

Wraps a std listener

pub fn from_mio(
    listener: TcpListener,
    handle: LazyHandle
) -> Result<TcpListener, Error>
[src]

Wraps a mio listener

pub fn local_addr(&self) -> Result<SocketAddr, Error>[src]

Returns the local socket address of this listener.

pub fn try_clone(&self) -> Result<TcpListener, Error>[src]

Creates a new independently owned handle to the underlying socket.

The new listener isn't registered to a reactor yet.

pub fn try_clone_with(&self, handle: LazyHandle) -> Result<TcpListener, Error>[src]

Creates a new independently owned handle to the underlying socket.

Important traits for TcpIncoming<'_>
pub fn incoming(&mut self) -> TcpIncoming[src]

Stream of incoming (TcpStream, SocketAddr) connections.

pub fn incoming_std(&mut self) -> TcpIncomingStd[src]

Stream of incoming (std::net::TcpStream, SocketAddr) connections.

pub fn poll_accept(
    &mut self,
    cx: &mut Context
) -> Poll<Result<(TcpStream, SocketAddr), Error>>
[src]

Accept a new connection or register context.

pub fn poll_accept_std(
    &mut self,
    cx: &mut Context
) -> Poll<Result<(TcpStream, SocketAddr), Error>>
[src]

Accept a new std connection or register context.

Trait Implementations

impl TryFrom<TcpListener> for TcpListener[src]

type Error = Error

The type returned in the event of a conversion error.

impl TryFrom<TcpListener> for TcpListener[src]

type Error = Error

The type returned in the event of a conversion error.

impl Debug for TcpListener[src]

Auto Trait Implementations

Blanket Implementations

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]