embedded_nal

Trait TcpFullStack

Source
pub trait TcpFullStack: TcpClientStack {
    // Required methods
    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§

Source

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

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.

Source

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

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.

Source

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

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§

Source§

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