Skip to content

Commit

Permalink
WiFiServer.accept() and ArduinoWiFiServer class doc update
Browse files Browse the repository at this point in the history
  • Loading branch information
JAndrassy committed Dec 26, 2021
1 parent ae78ae8 commit 9e52826
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 3 deletions.
18 changes: 17 additions & 1 deletion doc/esp8266wifi/server-class.rst
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,29 @@ Methods documented for the `Server Class <https://www.arduino.cc/en/Reference/Wi
5. `print() <https://www.arduino.cc/en/Reference/WiFiServerPrint>`__
6. `println() <https://www.arduino.cc/en/Reference/WiFiServerPrintln>`__

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 <https://www.arduino.cc/en/Reference/WiFi>`__ documentation. Before they are fully documented please refer to information below.

accept
~~~~~~

Method ``accept()`` returns a waiting client connection. `accept() is documented <https://www.arduino.cc/en/Reference/EthernetServerAccept>`__ for the Arduino Ethernet library.

available
~~~~~~~~~
.. 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``.

write (write to all clients) not supported
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

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::available()`` method to communicate with individual clients. If you need to send
``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
Expand Down
4 changes: 2 additions & 2 deletions doc/esp8266wifi/server-examples.rst
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ Serving of this web page will be done in the ``loop()`` where server is waiting
void loop()
{
WiFiClient client = server.available();
WiFiClient client = server.accept();
if (client)
{
// we have a new client sending some request
Expand Down Expand Up @@ -196,7 +196,7 @@ Complete sketch is presented below.
void loop()
{
WiFiClient client = server.available();
WiFiClient client = server.accept();
// wait for a client (web browser) to connect
if (client)
{
Expand Down

0 comments on commit 9e52826

Please sign in to comment.