#include <EthernetServer.h>
|
| | EthernetServer (uint16_t port=80) |
| | Creates a server for a TCP port.
|
| |
| EthernetClient | available () |
| | Returns a client that has data ready to read.
|
| |
| virtual void | begin () |
| | Starts listening on the current port.
|
| |
| virtual void | begin (uint16_t port) |
| | Sets a new port and starts listening on it.
|
| |
| void | end (void) |
| | Stops the server.
|
| |
| virtual size_t | write (uint8_t b) |
| | Writes one byte to every accepted client.
|
| |
| virtual size_t | write (const uint8_t *buffer, size_t size) |
| | Writes a buffer to every accepted client.
|
| |
| virtual | operator bool () |
| | Tests whether the server is listening.
|
| |
◆ EthernetServer()
| EthernetServer::EthernetServer |
( |
uint16_t |
port = 80 | ) |
|
Creates a server for a TCP port.
The server does not listen until begin() is called.
- Parameters
-
| port | TCP port to listen on. Defaults to 80. |
◆ available()
Returns a client that has data ready to read.
Releases closed client slots first. The returned client shares the connection structure of the server's slot.
- Returns
- An accepted client with data available, or a client with no connection if none has data.
◆ begin() [1/2]
| void EthernetServer::begin |
( |
| ) |
|
|
virtual |
Starts listening on the current port.
Does nothing if the server is already listening or if the TCP control block cannot be created or bound. Failures are not reported.
◆ begin() [2/2]
| void EthernetServer::begin |
( |
uint16_t |
port | ) |
|
|
virtual |
Sets a new port and starts listening on it.
- Parameters
-
| port | TCP port to listen on. |
◆ end()
| void EthernetServer::end |
( |
void |
| ) |
|
Stops the server.
Closes and frees all accepted clients, then closes the listening connection.
◆ operator bool()
| EthernetServer::operator bool |
( |
| ) |
|
|
virtual |
Tests whether the server is listening.
- Returns
- true if the server has a listening connection, false otherwise.
◆ write() [1/2]
| size_t EthernetServer::write |
( |
const uint8_t * |
buffer, |
|
|
size_t |
size |
|
) |
| |
|
virtual |
Writes a buffer to every accepted client.
The same data is sent to each client. Clients that are not accepted are skipped.
- Parameters
-
| buffer | Data to send. |
| size | Number of bytes in buffer. |
- Returns
- The sum of the bytes written to each client. This can be larger than size when several clients are connected.
◆ write() [2/2]
| size_t EthernetServer::write |
( |
uint8_t |
b | ) |
|
|
virtual |
Writes one byte to every accepted client.
- Parameters
-
- Returns
- The total number of bytes written to all clients.
The documentation for this class was generated from the following files: