[][src]Struct cancellable_io::TcpListener

pub struct TcpListener { /* fields omitted */ }

A TCP socket server, listening for connections.

The socket will be closed when the value is dropped.

The accept and the incoming methods can be interrupted using the Canceller object created with the socket.

Otherwise similar to std::net::TcpListener.

Methods

impl TcpListener[src]

pub fn bind<A: ToSocketAddrs>(address: A) -> Result<(Self, Canceller)>[src]

Creates a new TcpListener which will be bound to the specified address, together with an object that allows cancelling accept operations.

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

Returns the local socket address of this listener.

pub fn try_clone(&self) -> Result<(Self, Canceller)>[src]

Creates a new independently owned handle to the underlying socket.

pub fn accept(&self) -> Result<(TcpStream, Canceller, SocketAddr)>[src]

Accepts a new incoming connection from this listener.

This method can be cancelled by the associated Canceller object.

This method returns a TcpStream with an associated Canceller and the address of the remote peer.

Important traits for Incoming<'a>
pub fn incoming(&self) -> Incoming[src]

Returns an iterator over the connections being received by this listener.

The iteration can be cancelled by the associated Canceller object. If the iteration is cancelled, the next() method will return an error that can be identified with is_cancelled.

pub fn set_ttl(&self, ttl: u32) -> Result<()>[src]

Sets the value for the IP_TTL option on this socket.

pub fn ttl(&self) -> Result<u32>[src]

Gets the value for the IP_TTL option for this socket.

pub fn take_error(&self) -> Result<Option<Error>>[src]

Gets the value for the SO_ERROR option for this socket.

pub fn set_nonblocking(&self, nonblocking: bool) -> Result<()>[src]

Moves this TCP connection into or out of non blocking mode.

Trait Implementations

impl Debug for TcpListener[src]

Auto Trait Implementations

impl Send for TcpListener

impl !Sync for TcpListener

Blanket Implementations

impl<T> From for T[src]

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

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

type Error = Infallible

The type returned in the event of a conversion error.

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

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

impl<T, U> TryInto 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> Any for T where
    T: 'static + ?Sized
[src]