orphan: |
---|
Methods documented for the Server Class in Arduino
In ESP8266WiFi library the ArduinoWiFiServer
class implements available
and the write-to-all-clients functionality as described in the Arduino WiFi library reference. The PageServer example shows how available
and the write-to-all-clients works.
For most use cases the basic WiFiServer class of the ESP8266WiFi library is suitable.
Methods and properties described further down are specific to ESP8266. They are not covered in Arduino WiFi library documentation. Before they are fully documented please refer to information below.
Additionally to begin()
without parameter and a constructor with parameter port
, ESP8266WiFi library has begin(uint16_t port)
and a constructor without parameters. If port is not specified with constructor and begin
without parameter is used, the server is started on port 23.
Method accept()
returns a waiting client connection. accept() is documented for the Arduino Ethernet library.
.. deprecated:: 3.1.0 see ``accept``
available
in the ESP8266WiFi library's WiFiServer class doesn't work as documented for the Arduino WiFi library. It works the same way as accept
.
Please note that the write
method on the WiFiServer
object is not implemented and returns failure always. Use the returned
WiFiClient
object from the WiFiServer::accept()
method to communicate with individual clients. If you need to send
the exact same packets to a series of clients, your application must maintain a list of connected clients and iterate over them manually.
setNoDelay(nodelay)
With nodelay
set to true
, this function will to disable Nagle algorithm.
This algorithm is intended to reduce TCP/IP traffic of small packets sent over the network by combining a number of small outgoing messages, and sending them all at once. The downside of such approach is effectively delaying individual messages until a big enough packet is assembled.
Example:
server.begin();
server.setNoDelay(true);
By default, nodelay
value will depends on global WiFiClient::getDefaultNoDelay()
(currently false by default).
However, a call to wiFiServer.setNoDelay()
will override NoDelay
for all new WiFiClient
provided by the calling instance (wiFiServer
).
bool hasClient ()
size_t hasClientData ()
bool hasMaxPendingClients ()
bool getNoDelay ()
virtual size_t write (const uint8_t *buf, size_t size)
uint8_t status ()
void close ()
void stop ()
Documentation for the above functions is not yet prepared.
For code samples please refer to separate section with examples dedicated specifically to the Server Class.