Trait hyper::net::NetworkListener [-] [+] [src]

pub trait NetworkListener: Clone {
    type Stream: NetworkStream + Send + Clone;

    fn accept(&mut self) -> Result<Self::Stream>;
    fn socket_addr(&mut self) -> Result<SocketAddr>;

    fn incoming(&mut self) -> NetworkConnections<Self> { ... }
}

An abstraction to listen for connections on a certain port.

Associated Types

type Stream: NetworkStream + Send + Clone

The stream produced for each connection.

Required Methods

fn accept(&mut self) -> Result<Self::Stream>

Listens on a socket. Returns an iterator of streams.

fn socket_addr(&mut self) -> Result<SocketAddr>

Get the address this Listener ended up listening on.

Provided Methods

fn incoming(&mut self) -> NetworkConnections<Self>

Closes the Acceptor, so no more incoming connections will be handled. Returns an iterator over incoming connections.

Implementors