pub trait TcpFullStack: TcpClientStack {
    type BindFuture<'m>: Future<Output = Result<(), Self::Error>> + 'm
    where
        Self: 'm
; type ListenFuture<'m>: Future<Output = Result<(), Self::Error>> + 'm
    where
        Self: 'm
; type AcceptFuture<'m>: Future<Output = Result<(Self::TcpSocket, SocketAddr), Self::Error>> + 'm
    where
        Self: 'm
; fn bind<'m>(
        &'m mut self,
        socket: &'m mut Self::TcpSocket,
        local_port: u16
    ) -> Self::BindFuture<'m>; fn listen<'m>(
        &'m mut self,
        socket: &'m mut Self::TcpSocket
    ) -> Self::ListenFuture<'m>; fn accept<'m>(
        &'m mut self,
        socket: &'m mut Self::TcpSocket
    ) -> Self::AcceptFuture<'m>; }
Expand description

This trait is implemented by TCP/IP stacks that expose TCP server functionality. TCP servers may listen for connection requests to establish multiple unique TCP connections with various clients.

Required Associated Types

Future returned by bind function.

Future returned by listen function.

Future returned by accept function.

Required Methods

Create a new TCP socket and bind it to the specified local port.

Returns Ok when a socket is successfully bound to the specified local port. Otherwise, an Err(e) variant is returned.

Begin listening for connection requests on a previously-bound socket.

Returns Ok if the socket was successfully transitioned to the listening state. Otherwise, an Err(e) variant is returned.

Accept an active connection request on a listening socket.

Returns Ok(connection) if a new connection was created. If no pending connections are available, this function should return [nb::Error::WouldBlock].

Implementors