[][src]Trait embedded_nal::TcpServer

pub trait TcpServer: TcpClient {
    pub fn bind(
        &self,
        socket: &mut Self::TcpSocket,
        local_port: u16
    ) -> Result<(), Self::Error>;
pub fn listen(
        &self,
        socket: &mut Self::TcpSocket
    ) -> Result<(), Self::Error>;
pub fn accept(
        &self,
        socket: &mut Self::TcpSocket
    ) -> Result<(Self::TcpSocket, SocketAddr), Self::Error>; }

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

pub fn bind(
    &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.

pub fn listen(&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.

pub fn accept(
    &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.

Loading content...

Implementors

Loading content...