Struct lunatic::net::TcpListener[][src]

pub struct TcpListener { /* fields omitted */ }

A TCP server, listening for connections.

After creating a TcpListener by binding it to an address, it listens for incoming TCP connections. These can be accepted by calling accept().

Cloning a TcpListener creates another handle to the same socket. The socket will be closed when all handles to it are dropped.

The Transmission Control Protocol is specified in IETF RFC 793.

Examples

use lunatic::net::TcpListener;

Implementations

impl TcpListener[src]

pub fn bind<A>(addr: A) -> Result<Self> where
    A: ToSocketAddrs
[src]

Creates a new TcpListener bound to the given address.

Binding with a port number of 0 will request that the operating system assigns an available port to this listener.

If addr yields multiple addresses, binding will be attempted with each of the addresses until one succeeds and returns the listener. If none of the addresses succeed in creating a listener, the error from the last attempt is returned.

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

Accepts a new incoming connection.

Returns a TCP stream.

Trait Implementations

impl Clone for TcpListener[src]

impl<'de> Deserialize<'de> for TcpListener[src]

impl Serialize for TcpListener[src]

Auto Trait Implementations

Blanket Implementations

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

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

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

impl<T> DeserializeOwned for T where
    T: for<'de> Deserialize<'de>, 
[src]

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

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

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

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.