5#if defined(USE_SOCKET_IMPL_LWIP_TCP) || defined(USE_SOCKET_IMPL_LWIP_SOCKETS) || defined(USE_SOCKET_IMPL_BSD_SOCKETS)
32 void begin(
const char *tag);
42 void adopt(std::unique_ptr<Socket> sock);
46 size_t queue(
const uint8_t *data,
size_t len);
82 void drop_(
const LogString *what,
int err);
uint32_t IRAM_ATTR HOT get_loop_component_start_time() const
Get the cached time in milliseconds from when the current component started its loop execution.
StringRef is a reference to a string owned by something else.
constexpr const char * c_str() const
One IPv4 literal or hostname. Must outlive a pending lookup.
A reconnecting TCP stream driven from loop().
uint32_t reconnect_interval_ms_
void drop_(const LogString *what, int err)
Close after a failure, log what and errno, schedule the next attempt.
void tx_commit(size_t len)
ssize_t write_(const uint8_t *buf, size_t len)
The raw stream write behind flush_tx(); drops the link on a fatal error.
std::unique_ptr< Socket > sock_
const char * host() const
uint8_t tx_[TX_BUFFER_SIZE]
bool flush_tx()
Send the front of the buffer; true once it is empty.
uint32_t last_attempt_ms_
uint32_t reconnect_interval() const
void close()
Close without scheduling a reconnect (shutdown).
ssize_t read(uint8_t *buf, size_t len)
Returns bytes moved, 0 when nothing can move now, -1 when the link dropped.
void set_reconnect_interval(uint32_t ms)
void begin(const char *tag)
Call from setup(). tag names this link's log lines.
uint8_t * tx_tail()
Direct access to the buffer's free tail.
void note_attempt()
Shared retry clock, also usable for a listen socket.
bool connecting() const
A connect attempt is in flight.
void adopt(std::unique_ptr< Socket > sock)
Take over an accepted socket (the server side of a bridge).
static constexpr size_t TX_BUFFER_SIZE
size_t queue(const uint8_t *data, size_t len)
Copy into the outgoing buffer; returns how many bytes fit.
void set_port(uint16_t port)
void poll()
Connect state machine; call every loop while acting as a client.
void set_host(const char *host)
Application App
Global storage of Application pointer - only one Application can exist.