|
FabGL2 2.0.0
ESP32 Display Controller and Graphics Library for ESP-IDF
|
Simple TCP client based on BSD sockets (lwIP). More...
#include <netutils.h>
Public Member Functions | |
| int | available () |
| Returns the number of bytes available for reading. | |
| bool | connect (char const *host, int port, int timeOutMS=5000) |
| Connects to the specified host and port. | |
| bool | connected () |
| Determines whether the connection is still open (or received data is still pending). | |
| int | read () |
| Reads one byte (returns -1 if no data is available). | |
| int | read (uint8_t *buffer, size_t len) |
| Reads up to len bytes. | |
| int | socket () |
| Returns the socket descriptor (-1 if not connected). | |
| void | stop () |
| Closes the connection. | |
| size_t | write (char const *buffer, size_t len) |
| Sends a buffer of chars. | |
| size_t | write (char const *str) |
| Sends a zero-terminated string. | |
| size_t | write (uint8_t c) |
| Sends one byte. | |
| size_t | write (uint8_t const *buffer, size_t len) |
| Sends a buffer. | |
Simple TCP client based on BSD sockets (lwIP).
Example:
fabgl::TCPClient client;
if (client.connect("towel.blinkenlights.nl", 23)) {
while (client.connected()) {
if (client.available())
putchar(client.read());
}
}
Definition at line 404 of file netutils.h.