Skip to content

Commit 9e52826

Browse files
committed
WiFiServer.accept() and ArduinoWiFiServer class doc update
1 parent ae78ae8 commit 9e52826

File tree

2 files changed

+19
-3
lines changed

2 files changed

+19
-3
lines changed

doc/esp8266wifi/server-class.rst

+17-1
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,29 @@ Methods documented for the `Server Class <https://www.arduino.cc/en/Reference/Wi
1212
5. `print() <https://www.arduino.cc/en/Reference/WiFiServerPrint>`__
1313
6. `println() <https://www.arduino.cc/en/Reference/WiFiServerPrintln>`__
1414

15+
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.
16+
17+
For most use cases the basic WiFiServer class of the ESP8266WiFi library is suitable.
18+
1519
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.
1620

21+
accept
22+
~~~~~~
23+
24+
Method ``accept()`` returns a waiting client connection. `accept() is documented <https://www.arduino.cc/en/Reference/EthernetServerAccept>`__ for the Arduino Ethernet library.
25+
26+
available
27+
~~~~~~~~~
28+
.. deprecated:: 3.1.0
29+
see ``accept``
30+
31+
``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``.
32+
1733
write (write to all clients) not supported
1834
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1935

2036
Please note that the ``write`` method on the ``WiFiServer`` object is not implemented and returns failure always. Use the returned
21-
``WiFiClient`` object from the ``WiFiServer::available()`` method to communicate with individual clients. If you need to send
37+
``WiFiClient`` object from the ``WiFiServer::accept()`` method to communicate with individual clients. If you need to send
2238
the exact same packets to a series of clients, your application must maintain a list of connected clients and iterate over them manually.
2339

2440
setNoDelay

doc/esp8266wifi/server-examples.rst

+2-2
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ Serving of this web page will be done in the ``loop()`` where server is waiting
9292
9393
void loop()
9494
{
95-
WiFiClient client = server.available();
95+
WiFiClient client = server.accept();
9696
if (client)
9797
{
9898
// we have a new client sending some request
@@ -196,7 +196,7 @@ Complete sketch is presented below.
196196
197197
void loop()
198198
{
199-
WiFiClient client = server.available();
199+
WiFiClient client = server.accept();
200200
// wait for a client (web browser) to connect
201201
if (client)
202202
{

0 commit comments

Comments
 (0)