* Add support for the WiFi chip on the Pico W board. * USB interrupt now no longer hard coded (conflicted with the WiFi IRQ). * Add in Pico W board to makeboards.py * Add in GPIO and variant support * Initialize WiFi in the Variant * Use manual LWIP, fix size accounting * Remove the SDK WiFi overrides * Pulling in work done in the ESP8266 core. * Make IPAddress support IPv6 * Build LWIP with IPv4 and IPv6 support * Use proper MAC * Avoid cyw_warn crash. Make macro to a comment while building * Add WiFiServer * Add WiFiUdp * Move LWIP-specific support files to LWIP_Ethernet * Add WiFi::ping (ICMP ping) * Move ICMP echo (ping) to LWIPIntfDev * Move hostByName to LwipIntfDev * Add AP mode with simple DHCP server * Add some examples and basic ESP8266 compat hacks * Update Adafruit TinyUSB to fix crash * Set DHCP hostname * Make Wifi.begin() return CONNECTED with link + IP * Return connected() on WiFi::begin * Fix spurious TCP retransmission * Protect LWIP from reentrancy The Pico SDK calls "sys_check_timeouts() from inside a periodic interrupt. This appears unsafe, as the interrupt could happen while already in the (non-reentrant) LWIP code. Block the interrupt from calling sys_check_timeouts by using a global flag manually set via an RAII recursive lock. Add interrupt protection macros around critical sections inside LWIP via the standard defines. These two changes should make LWIP significantly more stable and long running. * Support disconnecting and reconnecting WiFi * Add WiFiServer simple example * Update documentation Fixes #666 Fixed #665
75 lines
3.2 KiB
ReStructuredText
75 lines
3.2 KiB
ReStructuredText
:orphan:
|
|
|
|
Server Class
|
|
------------
|
|
|
|
Methods documented for the `Server Class <https://www.arduino.cc/en/Reference/WiFiServerConstructor>`__ in `Arduino <https://github.com/arduino/Arduino>`__
|
|
|
|
1. `WiFiServer() <https://www.arduino.cc/en/Reference/WiFiServer>`__
|
|
2. `begin() <https://www.arduino.cc/en/Reference/WiFiServerBegin>`__
|
|
3. `available() <https://www.arduino.cc/en/Reference/WiFiServerAvailable>`__
|
|
4. `write() <https://www.arduino.cc/en/Reference/WiFiServerWrite>`__
|
|
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
|
|
~~~~~~~~~
|
|
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::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
|
|
~~~~~~~~~~
|
|
|
|
.. code:: cpp
|
|
|
|
setNoDelay(nodelay)
|
|
|
|
With ``nodelay`` set to ``true``, this function will to disable `Nagle algorithm <https://en.wikipedia.org/wiki/Nagle%27s_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:*
|
|
|
|
.. code:: cpp
|
|
|
|
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``).
|
|
|
|
Other Function Calls
|
|
~~~~~~~~~~~~~~~~~~~~
|
|
|
|
.. code:: cpp
|
|
|
|
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.
|