ClearCore Library
List of all members | Public Member Functions
ClearCore::EthernetTcpServer Class Reference

Detailed Description

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>

+ Inheritance diagram for ClearCore::EthernetTcpServer:
+ Collaboration diagram for ClearCore::EthernetTcpServer:

Public Member Functions

 EthernetTcpServer (uint16_t port)
 Construct a TCP server. More...
 
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. More...
 
EthernetTcpClient Accept ()
 Return a client with an active connection. More...
 
uint32_t Send (const uint8_t *buff, uint32_t size) override
 Send data to all clients managed by the server. More...
 
uint32_t Send (uint8_t charToSend)
 Send data to all clients managed by the server. More...
 
uint32_t Send (const char *nullTermStr)
 Send data to all clients managed by the server. More...
 
bool Ready ()
 Is the server ready to accept a client? More...
 

Constructor & Destructor Documentation

ClearCore::EthernetTcpServer::EthernetTcpServer ( uint16_t  port)
explicit

Construct a TCP server.

Parameters
[in]portThe local port to listen for incoming TCP connections on.

Member Function Documentation

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.

Returns
Returns a TCP client with an active connection.
Note
The server will no longer track the client's reference.
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.

Returns
Returns a TCP client that has incoming data available to read.
Note
The server will continue to track the client's reference.
bool ClearCore::EthernetTcpServer::Ready ( )

Is the server ready to accept a client?

Returns
Return true if the server is ready to accept clients.
uint32_t ClearCore::EthernetTcpServer::Send ( const uint8_t *  buff,
uint32_t  size 
)
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.

Parameters
[in]buffA pointer to the beginning of the data to send.
[in]sizeThe maximum number of bytes to send.
Returns
The number of bytes written to each client.
Note
The contents of the supplied buffer represents the payload in an outgoing TCP packet.
uint32_t ClearCore::EthernetTcpServer::Send ( uint8_t  charToSend)
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.

Parameters
[in]charToSendA character to send to the clients.
Returns
The number of bytes written to each client.
uint32_t ClearCore::EthernetTcpServer::Send ( const char *  nullTermStr)
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.

Parameters
[in]nullTermStrA string to send to the clients.
Returns
The number of bytes written to each client.

The documentation for this class was generated from the following file: