Struct TcpClient

Source
pub struct TcpClient<'a, B, C> { /* private fields */ }
Expand description

A client type that connects to and performs send/receive operations with a remote server using the TCP protocol.

Implementations§

Source§

impl<'a, B, C> TcpClient<'a, B, C>

Source

pub fn build(wifi: &'a mut Wifi<B, C>) -> Self

Build a new instance of a TcpClient provided a Wifi instance.

Source

pub fn server_ip_address(&self) -> Option<IpAddress>

Get an IpAddress of the remote server to communicate with that is set by calling TcpClient::connect.

Source

pub fn server_hostname(&self) -> &str

Get a Hostname of the remote server to communicate with that is set by calling TcpClient::connect.

Source

pub fn port(&self) -> Port

Get a Port of the remote server to communicate with that is set by calling TcpClient::connect.

Source

pub fn mode(&self) -> TransportMode

Get a TransportMode used in communication with the remote server that is set by calling TcpClient::connect.

Source

pub fn get_socket(&mut self) -> Result<u8, Error>

Request current Socket handle.

Source

pub fn send_data(&mut self, data: &str) -> Result<[u8; 8], Error>

Send a string slice of data to a connected server.

Trait Implementations§

Source§

impl<'a, B, C> Connect<'a, &str, B, C> for TcpClient<'a, B, C>

Source§

fn connect<F: FnMut(&mut TcpClient<'a, B, C>), D: DelayMs<u16>>( &mut self, server_hostname: Hostname<'_>, port: Port, mode: TransportMode, delay: &mut D, f: &mut F, ) -> Result<(), Error>

Enable a client to connect to server on port using transport layer mode.
Source§

impl<'a, B, C> Connect<'a, [u8; 4], B, C> for TcpClient<'a, B, C>

Source§

fn connect<F: FnMut(&mut TcpClient<'a, B, C>), D: DelayMs<u16>>( &mut self, ip: IpAddress, port: Port, mode: TransportMode, delay: &mut D, f: &mut F, ) -> Result<(), Error>

Enable a client to connect to server on port using transport layer mode.

Auto Trait Implementations§

§

impl<'a, B, C> Freeze for TcpClient<'a, B, C>

§

impl<'a, B, C> !RefUnwindSafe for TcpClient<'a, B, C>

§

impl<'a, B, C> Send for TcpClient<'a, B, C>
where C: Send, B: Send,

§

impl<'a, B, C> !Sync for TcpClient<'a, B, C>

§

impl<'a, B, C> Unpin for TcpClient<'a, B, C>

§

impl<'a, B, C> !UnwindSafe for TcpClient<'a, B, C>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.