MySensors Library & Examples  2.3.2-36-g2e00bf6
Public Member Functions | List of all members
EthernetServer Class Reference

Detailed Description

EthernetServer class.

Definition at line 42 of file EthernetServer.h.

#include <EthernetServer.h>

+ Inheritance diagram for EthernetServer:
+ Collaboration diagram for EthernetServer:

Public Member Functions

 EthernetServer (uint16_t port, uint16_t max_clients=ETHERNETSERVER_MAX_CLIENTS)
 EthernetServer constructor. More...
 
virtual void begin ()
 Listen for inbound connection request. More...
 
void begin (IPAddress addr)
 Listen on the specified ip for inbound connection request. More...
 
bool hasClient ()
 Verifies if a new client has connected. More...
 
EthernetClient available ()
 Get the new connected client. More...
 
virtual size_t write (uint8_t b)
 Write a byte to all clients. More...
 
virtual size_t write (const uint8_t *buffer, size_t size)
 Write at most 'size' bytes to all clients. More...
 
size_t write (const char *str)
 Write a null-terminated string to all clients. More...
 
size_t write (const char *buffer, size_t size)
 Write at most 'size' characters to all clients. More...
 

Constructor & Destructor Documentation

◆ EthernetServer()

EthernetServer::EthernetServer ( uint16_t  port,
uint16_t  max_clients = ETHERNETSERVER_MAX_CLIENTS 
)

EthernetServer constructor.

Parameters
portnumber for the socket addresses.
max_clientsThe maximum number allowed for connected clients.

Member Function Documentation

◆ available()

EthernetClient EthernetServer::available ( )

Get the new connected client.

Returns
a EthernetClient object; if no new client has connected, this object will evaluate to false.

◆ begin() [1/2]

virtual void EthernetServer::begin ( )
virtual

Listen for inbound connection request.

◆ begin() [2/2]

void EthernetServer::begin ( IPAddress  addr)

Listen on the specified ip for inbound connection request.

Parameters
addrIP address to bind to.

◆ hasClient()

bool EthernetServer::hasClient ( )

Verifies if a new client has connected.

Returns
true if a new client has connected, else false.

◆ write() [1/4]

size_t EthernetServer::write ( const char *  buffer,
size_t  size 
)

Write at most 'size' characters to all clients.

Parameters
bufferto read from.
sizeof the buffer.
Returns
0 if FAILURE else the number of characters sent.

◆ write() [2/4]

size_t EthernetServer::write ( const char *  str)

Write a null-terminated string to all clients.

Parameters
strString to write.
Returns
0 if FAILURE else number of characters sent.

◆ write() [3/4]

virtual size_t EthernetServer::write ( const uint8_t *  buffer,
size_t  size 
)
virtual

Write at most 'size' bytes to all clients.

Parameters
bufferto read from.
sizeof the buffer.
Returns
0 if FAILURE else number of bytes sent.

◆ write() [4/4]

virtual size_t EthernetServer::write ( uint8_t  b)
virtual

Write a byte to all clients.

Parameters
bbyte to send.
Returns
0 if FAILURE or 1 if SUCCESS.

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