Trait embedded_nal::TcpFullStack[][src]

pub trait TcpFullStack: TcpClientStack {
    fn bind(
        &mut self,
        socket: &mut Self::TcpSocket,
        local_port: u16
    ) -> Result<(), Self::Error>;
fn listen(
        &mut self,
        socket: &mut Self::TcpSocket
    ) -> Result<(), Self::Error>;
fn accept(
        &mut self,
        socket: &mut Self::TcpSocket
    ) -> Result<(Self::TcpSocket, SocketAddr), Self::Error>; }
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 methods

fn bind(
    &mut self,
    socket: &mut Self::TcpSocket,
    local_port: u16
) -> Result<(), Self::Error>
[src]

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.

fn listen(&mut self, socket: &mut Self::TcpSocket) -> Result<(), Self::Error>[src]

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.

fn accept(
    &mut self,
    socket: &mut Self::TcpSocket
) -> Result<(Self::TcpSocket, SocketAddr), Self::Error>
[src]

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

impl<'a, T> TcpFullStack for SharedStack<'a, T> where
    T: TcpFullStack
[src]

fn bind(
    &mut self,
    socket: &mut Self::TcpSocket,
    port: u16
) -> Result<(), <T as TcpClientStack>::Error>
[src]

fn listen(
    &mut self,
    socket: &mut Self::TcpSocket
) -> Result<(), <T as TcpClientStack>::Error>
[src]

fn accept(
    &mut self,
    socket: &mut Self::TcpSocket
) -> Result<(<T as TcpClientStack>::TcpSocket, SocketAddr), Error<<T as TcpClientStack>::Error>>
[src]