pub struct ListenStack<const QUEUELEN: usize> { /* private fields */ }
Available on
riot_module_sock_tcp
and crate feature with_embedded_nal
only.Expand description
A view on the RIOT socket stack that is prepared for a single listening socket that can accept QUEUELEN connections simultaneously.
Note that unless CONFIG_GNRC_TCP_RCV_BUFFERS is overridden, QUEUELEN is limited to 1, anything more makes it fail at setup time.
To use it as an implementation of TcpFullStack, it needs to be pinned, eg. by
pin_utils::pin_mut!(stack)
, and later passed as mutable refernce to the pinned item.
Note that while it would be perfectly feasible to count the number of open connection and allow this to be dropped when all connections are closed, this will only be implemented once there is any case that needs it (as most RIOT servers are up indefinitely).
Trait Implementations§
source§impl<const QUEUELEN: usize> Default for ListenStack<QUEUELEN>
impl<const QUEUELEN: usize> Default for ListenStack<QUEUELEN>
source§impl<const QUEUELEN: usize> Drop for ListenStack<QUEUELEN>
impl<const QUEUELEN: usize> Drop for ListenStack<QUEUELEN>
source§impl<'a, const QUEUELEN: usize> TcpClientStack for Pin<&'a mut ListenStack<QUEUELEN>>
impl<'a, const QUEUELEN: usize> TcpClientStack for Pin<&'a mut ListenStack<QUEUELEN>>
§type Error = NumericError
type Error = NumericError
The type returned when we have an error
source§fn socket(&mut self) -> Result<Self::TcpSocket, Self::Error>
fn socket(&mut self) -> Result<Self::TcpSocket, Self::Error>
Open a socket for usage as a TCP client. Read more
source§fn connect(
&mut self,
_sock: &mut Self::TcpSocket,
_addr: SocketAddr
) -> Result<(), Error<Self::Error>>
fn connect( &mut self, _sock: &mut Self::TcpSocket, _addr: SocketAddr ) -> Result<(), Error<Self::Error>>
Connect to the given remote host and port. Read more
source§fn is_connected(&mut self, sock: &Self::TcpSocket) -> Result<bool, Self::Error>
fn is_connected(&mut self, sock: &Self::TcpSocket) -> Result<bool, Self::Error>
Check if this socket is connected
source§fn send(
&mut self,
sock: &mut Self::TcpSocket,
buf: &[u8]
) -> Result<usize, Error<Self::Error>>
fn send( &mut self, sock: &mut Self::TcpSocket, buf: &[u8] ) -> Result<usize, Error<Self::Error>>
Write to the stream. Read more
source§impl<'a, const QUEUELEN: usize> TcpExactStack for Pin<&'a mut ListenStack<QUEUELEN>>
impl<'a, const QUEUELEN: usize> TcpExactStack for Pin<&'a mut ListenStack<QUEUELEN>>
source§const RECVBUFLEN: usize = 1_152usize
const RECVBUFLEN: usize = 1_152usize
Capacity of the connection’s TCP buffer. Read more
source§const SENDBUFLEN: usize = 1_152usize
const SENDBUFLEN: usize = 1_152usize
Capacity of the connection’s TCP send buffer. Read more
source§impl<'a, const QUEUELEN: usize> TcpFullStack for Pin<&'a mut ListenStack<QUEUELEN>>
impl<'a, const QUEUELEN: usize> TcpFullStack for Pin<&'a mut ListenStack<QUEUELEN>>
source§fn bind(
&mut self,
sock: &mut Self::TcpSocket,
port: u16
) -> Result<(), Self::Error>
fn bind( &mut self, sock: &mut Self::TcpSocket, port: u16 ) -> Result<(), Self::Error>
Create a new TCP socket and bind it to the specified local port. Read more
Auto Trait Implementations§
impl<const QUEUELEN: usize> RefUnwindSafe for ListenStack<QUEUELEN>
impl<const QUEUELEN: usize> !Send for ListenStack<QUEUELEN>
impl<const QUEUELEN: usize> !Sync for ListenStack<QUEUELEN>
impl<const QUEUELEN: usize> !Unpin for ListenStack<QUEUELEN>
impl<const QUEUELEN: usize> UnwindSafe for ListenStack<QUEUELEN>
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more