ClearCore Library
|
ClearCore TCP server class.
This class manages an instance of a TCP server and manages interactions with multiple Ethernet TCP client connections.
For more detailed information on the ClearCore Ethernet system, check out the ClearCore Ethernet informational page.
ClearCore TCP server class. More...
#include <EthernetTcpServer.h>
Public Member Functions | |
EthernetTcpServer (uint16_t port) | |
Construct a TCP server. | |
void | Begin () |
Set up the server to begin listening for incoming TCP connections. | |
EthernetTcpClient | Available () |
Return a reference to a client that has incoming data. | |
EthernetTcpClient | Accept () |
Return a client with an active connection. | |
uint32_t | Send (const uint8_t *buff, uint32_t size) override |
Send data to all clients managed by the server. | |
uint32_t | Send (uint8_t charToSend) |
Send data to all clients managed by the server. | |
uint32_t | Send (const char *nullTermStr) |
Send data to all clients managed by the server. | |
bool | Ready () |
Is the server ready to accept a client? | |
|
explicit |
Construct a TCP server.
[in] | port | The local port to listen for incoming TCP connections on. |
EthernetTcpClient ClearCore::EthernetTcpServer::Accept | ( | ) |
Return a client with an active connection.
Returns a client with an active connection. The server will only return an active client once, and then the server will no longer manage the client's connection.
EthernetTcpClient ClearCore::EthernetTcpServer::Available | ( | ) |
Return a reference to a client that has incoming data.
Returns a reference to a client that has incoming data available to read. The server will continue to manage the client.
bool ClearCore::EthernetTcpServer::Ready | ( | ) |
Is the server ready to accept a client?
|
inline |
Send data to all clients managed by the server.
Send a TCP packet to each client managed by the server with a string of characters as the payload.
[in] | nullTermStr | A string to send to the clients. |
|
override |
Send data to all clients managed by the server.
Send a TCP packet to each client managed by the server with the contents of the provided buffer as the packet's payload.
[in] | buff | A pointer to the beginning of the data to send. |
[in] | size | The maximum number of bytes to send. |
|
inline |
Send data to all clients managed by the server.
Send a TCP packet to each client managed by the server with a character as the payload.
[in] | charToSend | A character to send to the clients. |