#embedded/wifi/tcp
Xu 0.13.1 API
import: #embedded/wifi/tcp
counts: 1 functions, 8 methods, 1 types, 0 constants, 0 method sets
Standard library package `#embedded/wifi/tcp`.
struct Client
pub struct Client {
pub retransmits int
}
Purpose
One cooperative, bounded TCP active open. Call receive after link validation, drain read regularly and submit poll output outside the radio receive frame.
Public fields
retransmits int- field (int)
create
pub fn create(local string, peer string, local_port int, peer_port int, initial string, now int) Client
Purpose
Create a new file, directory, or resource.
Parameters
local string- local (string)
peer string- peer (string)
local_port int- local_port (int)
peer_port int- peer_port (int)
initial string- initial (string)
now int- now (int)
Returns
Client — a value of this type
(&Client) connected
pub fn (c &Client) connected() bool
Purpose
Execute connected on &Client.
Parameters
c &Client- The
Client instance used by this call (borrow).
Returns
bool — true or false
(&Client) failed
pub fn (c &Client) failed() bool
Purpose
Execute failed on &Client.
Parameters
c &Client- The
Client instance used by this call (borrow).
Returns
bool — true or false
(&Client) writable
pub fn (c &Client) writable() bool
Purpose
Execute writable on &Client.
Parameters
c &Client- The
Client instance used by this call (borrow).
Returns
bool — true or false
($&Client) write
pub fn (c $&Client) write(bytes &string) bool
Purpose
Operation on $&Client: write data and return the byte count.
Parameters
c $&Client- The
Client instance used by this call (exclusive borrow).
bytes &string- bytes (read-only borrow; caller keeps the original; type &string)
Returns
bool — true or false
($&Client) read
pub fn (c $&Client) read() string
Purpose
Operation on $&Client: read up to max bytes.
Parameters
c $&Client- The
Client instance used by this call (exclusive borrow).
Returns
string — result string
($&Client) receive
pub fn (c $&Client) receive(packet &string)
Purpose
Execute receive on $&Client.
Parameters
c $&Client- The
Client instance used by this call (exclusive borrow).
packet &string- packet (read-only borrow; caller keeps the original; type &string)
Returns
This call does not return a value.
($&Client) poll
pub fn (c $&Client) poll(now int) string
Purpose
Execute poll on $&Client.
Parameters
c $&Client- The
Client instance used by this call (exclusive borrow).
now int- now (int)
Returns
string — result string
($&Client) reset
pub fn (c $&Client) reset(local string, peer string, local_port int, peer_port int, initial string, now int)
Purpose
Operation on $&Client: clear internal state so the value can be reused.
Parameters
c $&Client- The
Client instance used by this call (exclusive borrow).
local string- local (string)
peer string- peer (string)
local_port int- local_port (int)
peer_port int- peer_port (int)
initial string- initial (string)
now int- now (int)
Returns
This call does not return a value.