pub struct TcpClient<'d, const N: usize, const TX_SZ: usize = 1024, const RX_SZ: usize = 1024> { /* private fields */ }
Expand description
TCP client connection pool compatible with embedded-nal-async
traits.
The pool is capable of managing up to N concurrent connections with tx and rx buffers according to TX_SZ and RX_SZ.
Implementations§
Source§impl<'d, const N: usize, const TX_SZ: usize, const RX_SZ: usize> TcpClient<'d, N, TX_SZ, RX_SZ>
impl<'d, const N: usize, const TX_SZ: usize, const RX_SZ: usize> TcpClient<'d, N, TX_SZ, RX_SZ>
Sourcepub fn new(stack: Stack<'d>, state: &'d TcpClientState<N, TX_SZ, RX_SZ>) -> Self
pub fn new(stack: Stack<'d>, state: &'d TcpClientState<N, TX_SZ, RX_SZ>) -> Self
Create a new TcpClient
.
Sourcepub fn set_timeout(&mut self, timeout: Option<Duration>)
pub fn set_timeout(&mut self, timeout: Option<Duration>)
Set the timeout for each socket created by this TcpClient
.
If the timeout is set, the socket will be closed if no data is received for the specified duration.
Trait Implementations§
Source§impl<'d, const N: usize, const TX_SZ: usize, const RX_SZ: usize> TcpConnect for TcpClient<'d, N, TX_SZ, RX_SZ>
impl<'d, const N: usize, const TX_SZ: usize, const RX_SZ: usize> TcpConnect for TcpClient<'d, N, TX_SZ, RX_SZ>
Source§type Connection<'m> = TcpConnection<'m, N, TX_SZ, RX_SZ>
where
Self: 'm
type Connection<'m> = TcpConnection<'m, N, TX_SZ, RX_SZ> where Self: 'm
Type holding state of a TCP connection. Should close the connection when dropped.
Source§async fn connect<'a>(
&'a self,
remote: SocketAddr,
) -> Result<Self::Connection<'a>, Self::Error>
async fn connect<'a>( &'a self, remote: SocketAddr, ) -> Result<Self::Connection<'a>, Self::Error>
Connect to the given remote host and port. Read more
Auto Trait Implementations§
impl<'d, const N: usize, const TX_SZ: usize, const RX_SZ: usize> Freeze for TcpClient<'d, N, TX_SZ, RX_SZ>
impl<'d, const N: usize, const TX_SZ: usize = 1024, const RX_SZ: usize = 1024> !RefUnwindSafe for TcpClient<'d, N, TX_SZ, RX_SZ>
impl<'d, const N: usize, const TX_SZ: usize = 1024, const RX_SZ: usize = 1024> !Send for TcpClient<'d, N, TX_SZ, RX_SZ>
impl<'d, const N: usize, const TX_SZ: usize = 1024, const RX_SZ: usize = 1024> !Sync for TcpClient<'d, N, TX_SZ, RX_SZ>
impl<'d, const N: usize, const TX_SZ: usize, const RX_SZ: usize> Unpin for TcpClient<'d, N, TX_SZ, RX_SZ>
impl<'d, const N: usize, const TX_SZ: usize = 1024, const RX_SZ: usize = 1024> !UnwindSafe for TcpClient<'d, N, TX_SZ, RX_SZ>
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