Code Monkey home page Code Monkey logo

khoih-prog / ethernetwebserver Goto Github PK

View Code? Open in Web Editor NEW
172.0 9.0 47.0 3.78 MB

This is simple yet complete WebServer library for AVR, AVR Dx, Portenta_H7, Teensy, SAM DUE, SAMD21/SAMD51, nRF52, STM32, RP2040-based, etc. boards running Ethernet shields. The functions are similar and compatible to ESP8266/ESP32 WebServer libraries to make life much easier to port sketches from ESP8266/ESP32. Coexisting now with `ESP32 WebServer` and `ESP8266 ESP8266WebServer` libraries. Ethernet_Generic library is used as default for W5x00 with custom SPI

License: MIT License

C 31.95% C++ 67.80% Shell 0.25%
ethernet webserver w5x00 http-server http-client http-requests enc28j60 nrf52 websockets teensy

ethernetwebserver's Introduction

EthernetWebServer

arduino-library-badge GitHub release GitHub contributions welcome GitHub issues

Donate to my libraries using BuyMeACoffee



Table of Contents



Important Note from v2.3.0

The new EthernetWebServer v2.4.1+ combined with the new Ethernet_Generic v2.7.0+ fixes severe limitation to permit sending much larger data than total than 2/4/8/16K buffer of W5x00 Ethernet.


Important Note from v2.2.2

To be safe for systems using old W5100 shields, the examples are using optional conservative values for SPI clock speed of 14MHz and SPI_MODE0

For SAMD21 M0, such as SAMD Zero, SPI clock speed of 8MHz and SPI_MODE0 are used.

// Default to use W5100. Must change to false for W5500, W5100S, for faster SPI clock
// Must use true for SAMD21, such as Zero, SAMD_FEATHER_M0_EXPRESS, etc.
#define USE_W5100                           true

To use with shields different from W5100, such as W5200, W5500, W5100S, change to

// Default to use W5100. Must change to false for W5500, W5100S, for faster SPI clock
#define USE_W5100                           false

For Arduino SAMD21 Zero, in order to print to Terminal, use SERIAL_PORT_USBVIRTUAL == SerialUSB

// Use this for ARDUINO_SAMD_ZERO, etc. if can't print to terminal with Serial.print
#if defined(SERIAL_PORT_USBVIRTUAL)
  #define Serial          SERIAL_PORT_USBVIRTUAL
  #warning Using SAMD Zero SerialUSB
#endif

Important Breaking Change from v2.0.0

From v2.0.0, breaking changes were made to permit coexistence with ESP32 WebServer and ESP8266 ESP8266WebServer libraries.

The changes will affect only ESP32 and ESP8266 code.

Using ethernetHTTPUpload instead of HTTPUpload

If server using EthernetWebServer, then use ethernetHTTPUpload instead of HTTPUpload. HTTPUpload can be used only with server using WiFi WebServer or ESP8266WebServer

For example, in these examples, server is using EthernetWebServer

just change from

HTTPUpload& upload = server.upload();

to

ethernetHTTPUpload& upload = server.upload();

Please check these new examples to see how to use the new features

  1. WiFi_Ethernet_Complex_ESP32
  2. WiFi_Ethernet_Complex_ESP8266

Why do we need this EthernetWebServer library

Features

This EthernetWebServer library is a simple yet complete WebServer library for AVR, Portenta_H7, Teensy, SAM DUE, Arduino SAMD21, Adafruit SAMD21/SAMD51, Adafruit nRF52, ESP32/ESP8266, STM32, RP2040-based, etc. boards using Ethernet shields. The functions are similar and compatible to those of ESP32 WebServer and ESP8266WebServer libraries to make life much easier to port sketches from ESP8266/ESP32.

The RP2040-based boards, such as RASPBERRY_PI_PICO, are currently supported using Arduino-mbed RP2040 core or Earle Philhower's arduino-pico core.

This EthernetWebServer library, from v1.1.0, also provides high-level HTTP and WebSocket Client with the functions are similar and compatible to those of ArduinoHttpClient Library

The library provides these features:

  1. TCP Server and Client
  2. UDP Server and Client
  3. HTTP Server and Client
  4. HTTP GET and POST requests, provides argument parsing, handles one client at a time.
  5. High-level HTTP (GET, POST, PUT, PATCH, DELETE) and WebSocket Client. From v1.1.0.

Library is based on and modified from:

  1. Ivan Grokhotkov's ESP8266WebServer
  2. Ivan Grokhotkov's ESP32 WebServer
  3. ArduinoHttpClient Library

The EthernetWebServer class, found in EthernetWebServer.h header, is a simple WebServer class, knowing how to handle HTTP requests such as GET and POST and can only support one simultaneous client.

Currently supported Boards

This EthernetWebServer library currently supports these following boards:

  1. nRF52 boards, such as AdaFruit Feather nRF52832, nRF52840 Express, BlueFruit Sense, Itsy-Bitsy nRF52840 Express, Metro nRF52840 Express, NINA_B302_ublox, NINA_B112_ublox, etc.
  2. SAM DUE
  3. SAMD21
  • Arduino SAMD21: ZERO, MKRs, NANO_33_IOT, etc.
  • Adafruit SAMD21 (M0): ItsyBitsy M0, Feather M0, Feather M0 Express, Metro M0 Express, Circuit Playground Express, Trinket M0, PIRkey, Hallowing M0, Crickit M0, etc.
  • Seeeduino: LoRaWAN, Zero, Femto M0, XIAO M0, Wio GPS Board, etc.
  1. SAMD51
  • Adafruit SAMD51 (M4): Metro M4, Grand Central M4, ItsyBitsy M4, Feather M4 Express, Trellis M4, Metro M4 AirLift Lite, MONSTER M4SK Express, Hallowing M4, etc.
  • Seeeduino: Wio Terminal, Grove UI Wireless
  1. Teensy (4.1, 4.0, 3.6, 3.5, 3,2, 3.1, 3.0, LC) with SPI, SPI1, SPI2

  2. AVR Mega1280, 2560, ADK.

  3. ESP32

  4. ESP8266

  5. RP2040-based boards, such as RASPBERRY_PI_PICO, ADAFRUIT_FEATHER_RP2040 and GENERIC_RP2040, using Arduino-mbed RP2040 core or Earle Philhower's arduino-pico core with SPI, SPI1

  6. Portenta_H7

  7. Arduino UNO WiFi Rev2, AVR_NANO_EVERY, etc.

  8. Arduino AVR_Dx boards using DxCore

  • AVRDA-based boards (AVR128DA, AVR64DA, AVR32DA, etc.)

  • AVRDB-based boards (AVR128DB, AVR64DB, AVR32DB, etc.)

  1. Seeeduino nRF52840-based boards such as XIAO_NRF52840 and XIAO_NRF52840_SENSE, etc. using Seeed mbed or nRF52 core

Currently supported Ethernet shields/modules

  1. W5x00/W5100S using Ethernet_Generic library

  2. W6100, such as such as WIZnet WIZ610MJ, using Ethernet_Generic library

  1. W5x00 using Ethernet, EthernetLarge, Ethernet2 or Ethernet3 library
  2. ENC28J60 using EthernetENC or UIPEthernet library
  3. Teensy 4.1 built-in Ethernet using NativeEthernet library
  4. Teensy 4.1 built-in Ethernet using QNEthernet library
  5. Portenta_H7 Ethernet using Portenta_Ethernet library


Prerequisites

  1. Arduino IDE 1.8.19+ for Arduino. GitHub release
  2. Arduino AVR core 1.8.6+ for Arduino (Use Arduino Board Manager) AVR boards. GitHub release
  3. Teensy core v1.57+ for Teensy (4.1, 4.0, 3.6, 3.5, 3,2, 3.1, 3.0) boards. GitHub release
  4. Arduino SAM DUE core v1.6.12+ for SAM DUE ARM Cortex-M3 boards.
  5. Arduino SAMD core 1.8.13+ for SAMD ARM Cortex-M0+ boards. GitHub release
  6. Adafruit SAMD core 1.7.11+ for SAMD ARM Cortex-M0+ and M4 boards (Nano 33 IoT, etc.). GitHub release
  7. Seeeduino SAMD core 1.8.3+ for SAMD21/SAMD51 boards (XIAO M0, Wio Terminal, etc.). Latest release
  8. Adafruit nRF52 v1.3.0+ for nRF52 boards such as Adafruit NRF52840_FEATHER, NRF52832_FEATHER, NRF52840_FEATHER_SENSE, NRF52840_ITSYBITSY, NRF52840_CIRCUITPLAY, NRF52840_CLUE, NRF52840_METRO, NRF52840_PCA10056, PARTICLE_XENON, NINA_B302_ublox, etc. GitHub release
  9. ESP32 Core 2.0.6+ for ESP32-based boards. Latest release
  10. ESP8266 Core 3.1.0+ for ESP8266-based boards. Latest release. To use ESP8266 core 2.7.1+ for LittleFS.
  11. ArduinoCore-mbed mbed_rp2040, mbed_nano, mbed_portenta core 3.5.1+ for Arduino (Use Arduino Board Manager) Portenta_H7, RP2040-based boards, such as Nano_RP2040_Connect, RASPBERRY_PI_PICO. GitHub release
  12. Earle Philhower's arduino-pico core v2.7.0+ for RP2040-based boards such as RASPBERRY_PI_PICO, ADAFRUIT_FEATHER_RP2040 and GENERIC_RP2040, etc. GitHub release
  13. Arduino megaAVR core 1.8.7+ for Arduino megaAVR boards such as Arduino UNO WiFi Rev2, AVR_NANO_EVERY, etc.. GitHub release
  14. SpenceKonde DxCore core 1.5.2+ for Arduino AVRDx boards. GitHub release. Follow DxCore Installation.
  15. Seeeduino nRF52 core 1.1.0+ for Seeed nRF52840-based boards such as Seeed_XIAO_NRF52840 and Seeed_XIAO_NRF52840_SENSE. GitHub release
  16. Seeeduino mbed core 2.9.0+ for Seeed nRF52840-based boards such as SEEED_XIAO_NRF52840 and SEEED_XIAO_NRF52840_SENSE. GitHub release
  17. Functional-Vlpp library v1.0.2+ to use server's lambda function. To install. check arduino-library-badge
  18. Depending on which Ethernet card you're using:


Installation

Use Arduino Library Manager

The best and easiest way is to use Arduino Library Manager. Search for EthernetWebServer, then select / install the latest version. You can also use this link arduino-library-badge for more detailed instructions.

Manual Install

  1. Navigate to EthernetWebServer page.
  2. Download the latest release EthernetWebServer-master.zip.
  3. Extract the zip file to EthernetWebServer-master directory
  4. Copy the whole EthernetWebServer-master folder to Arduino libraries' directory such as ~/Arduino/libraries/.

VS Code & PlatformIO:

  1. Install VS Code
  2. Install PlatformIO
  3. Install EthernetWebServer library by using Library Manager. Search for EthernetWebServer in Platform.io Author's Libraries
  4. Use included platformio.ini file from examples to ensure that all dependent libraries will installed automatically. Please visit documentation for the other options and examples at Project Configuration File


Packages' Patches

1. For Adafruit nRF52840 and nRF52832 boards

To be able to compile, run and automatically detect and display BOARD_NAME on nRF52840/nRF52832 boards, you have to copy the whole nRF52 Packages_Patches directory into Adafruit nRF52 directory (~/.arduino15/packages/adafruit/hardware/nrf52/1.3.0).

Supposing the Adafruit nRF52 version is 1.3.0. These files must be copied into the directory:

  • ~/.arduino15/packages/adafruit/hardware/nrf52/1.3.0/platform.txt
  • ~/.arduino15/packages/adafruit/hardware/nrf52/1.3.0/boards.txt
  • ~/.arduino15/packages/adafruit/hardware/nrf52/1.3.0/cores/nRF5/Udp.h
  • ~/.arduino15/packages/adafruit/hardware/nrf52/1.3.0/cores/nRF5/Print.h
  • ~/.arduino15/packages/adafruit/hardware/nrf52/1.3.0/cores/nRF5/Print.cpp
  • ~/.arduino15/packages/adafruit/hardware/nrf52/1.3.0/variants/NINA_B302_ublox/variant.h
  • ~/.arduino15/packages/adafruit/hardware/nrf52/1.3.0/variants/NINA_B302_ublox/variant.cpp
  • ~/.arduino15/packages/adafruit/hardware/nrf52/1.3.0/variants/NINA_B112_ublox/variant.h
  • ~/.arduino15/packages/adafruit/hardware/nrf52/1.3.0/variants/NINA_B112_ublox/variant.cpp
  • ~/.arduino15/packages/adafruit/hardware/nrf52/1.3.0/cores/nRF5/Udp.h

Whenever a new version is installed, remember to copy these files into the new version directory. For example, new version is x.yy.z These files must be copied into the directory:

  • ~/.arduino15/packages/adafruit/hardware/nrf52/x.yy.z/platform.txt
  • ~/.arduino15/packages/adafruit/hardware/nrf52/x.yy.z/boards.txt
  • ~/.arduino15/packages/adafruit/hardware/nrf52/x.yy.z/cores/nRF5/Udp.h
  • ~/.arduino15/packages/adafruit/hardware/nrf52/x.yy.z/cores/nRF5/Print.h
  • ~/.arduino15/packages/adafruit/hardware/nrf52/x.yy.z/cores/nRF5/Print.cpp
  • ~/.arduino15/packages/adafruit/hardware/nrf52/x.yy.z/variants/NINA_B302_ublox/variant.h
  • ~/.arduino15/packages/adafruit/hardware/nrf52/x.yy.z/variants/NINA_B302_ublox/variant.cpp
  • ~/.arduino15/packages/adafruit/hardware/nrf52/x.yy.z/variants/NINA_B112_ublox/variant.h
  • ~/.arduino15/packages/adafruit/hardware/nrf52/x.yy.z/variants/NINA_B112_ublox/variant.cpp
  • ~/.arduino15/packages/adafruit/hardware/nrf52/x.yy.z/cores/nRF5/Udp.h

2. For Teensy boards

To be able to compile and run on Teensy boards, you have to copy the files in Packages_Patches for Teensy directory into Teensy hardware directory (./arduino-1.8.19/hardware/teensy/avr/boards.txt).

Supposing the Arduino version is 1.8.19. These files must be copied into the directory:

  • ./arduino-1.8.19/hardware/teensy/avr/boards.txt
  • ./arduino-1.8.19/hardware/teensy/avr/cores/teensy/Stream.h
  • ./arduino-1.8.19/hardware/teensy/avr/cores/teensy3/Stream.h
  • ./arduino-1.8.19/hardware/teensy/avr/cores/teensy4/Stream.h

Whenever a new version is installed, remember to copy this file into the new version directory. For example, new version is x.yy.zz These files must be copied into the directory:

  • ./arduino-x.yy.zz/hardware/teensy/avr/boards.txt
  • ./arduino-x.yy.zz/hardware/teensy/avr/cores/teensy/Stream.h
  • ./arduino-x.yy.zz/hardware/teensy/avr/cores/teensy3/Stream.h
  • ./arduino-x.yy.zz/hardware/teensy/avr/cores/teensy4/Stream.h

3. For Arduino SAM DUE boards

To be able to compile and run on SAM DUE boards, you have to copy the whole SAM DUE directory into Arduino sam directory (~/.arduino15/packages/arduino/hardware/sam/1.6.12).

Supposing the Arduino SAM core version is 1.6.12. This file must be copied into the directory:

  • ~/.arduino15/packages/arduino/hardware/sam/1.6.12/platform.txt

Whenever a new version is installed, remember to copy this file into the new version directory. For example, new version is x.yy.zz This file must be copied into the directory:

  • ~/.arduino15/packages/arduino/hardware/sam/x.yy.zz/platform.txt

4. For Arduino SAMD boards

To be able to compile, run and automatically detect and display BOARD_NAME on Arduino SAMD (Nano-33-IoT, etc) boards, you have to copy the whole Arduino SAMD Packages_Patches directory into Arduino SAMD directory (~/.arduino15/packages/arduino/hardware/samd/1.8.13).

For core version v1.8.10+

Supposing the Arduino SAMD version is 1.8.13. Now only one file must be copied into the directory:

  • ~/.arduino15/packages/arduino/hardware/samd/1.8.13/platform.txt

Whenever a new version is installed, remember to copy this files into the new version directory. For example, new version is x.yy.zz

This file must be copied into the directory:

  • ~/.arduino15/packages/arduino/hardware/samd/x.yy.zz/platform.txt

For core version v1.8.9-

Supposing the Arduino SAMD version is 1.8.9. These files must be copied into the directory:

  • ~/.arduino15/packages/arduino/hardware/samd/1.8.9/platform.txt
  • ~/.arduino15/packages/arduino/hardware/samd/1.8.9/cores/arduino/Arduino.h

Whenever a new version is installed, remember to copy these files into the new version directory. For example, new version is x.yy.z

These files must be copied into the directory:

  • ~/.arduino15/packages/arduino/hardware/samd/x.yy.z/platform.txt
  • ~/.arduino15/packages/arduino/hardware/samd/x.yy.z/cores/arduino/Arduino.h

This is mandatory to fix the notorious Arduino SAMD compiler error. See Improve Arduino compatibility with the STL (min and max macro)

 ...\arm-none-eabi\include\c++\7.2.1\bits\stl_algobase.h:243:56: error: macro "min" passed 3 arguments, but takes just 2
     min(const _Tp& __a, const _Tp& __b, _Compare __comp)

Whenever the above-mentioned compiler error issue is fixed with the new Arduino SAMD release, you don't need to copy the Arduino.h file anymore.

5. For Adafruit SAMD boards

To be able to compile, run and automatically detect and display BOARD_NAME on Adafruit SAMD (Itsy-Bitsy M4, etc) boards, you have to copy the whole Adafruit SAMD Packages_Patches directory into Adafruit samd directory (~/.arduino15/packages/adafruit/hardware/samd/1.7.11).

Supposing the Adafruit SAMD core version is 1.7.11. These files must be copied into the directory:

  • ~/.arduino15/packages/adafruit/hardware/samd/1.7.11/platform.txt
  • ~/.arduino15/packages/adafruit/hardware/samd/1.7.11/cores/arduino/Print.h
  • ~/.arduino15/packages/adafruit/hardware/samd/1.7.11/cores/arduino/Print.cpp

Whenever a new version is installed, remember to copy this file into the new version directory. For example, new version is x.yy.zz These files must be copied into the directory:

  • ~/.arduino15/packages/adafruit/hardware/samd/x.yy.zz/platform.txt
  • ~/.arduino15/packages/adafruit/hardware/samd/x.yy.zz/cores/arduino/Print.h
  • ~/.arduino15/packages/adafruit/hardware/samd/x.yy.zz/cores/arduino/Print.cpp

6. For Seeeduino SAMD boards

To be able to compile, run and automatically detect and display BOARD_NAME on Seeeduino SAMD (XIAO M0, Wio Terminal, etc) boards, you have to copy the whole Seeeduino SAMD Packages_Patches directory into Seeeduino samd directory (~/.arduino15/packages/Seeeduino/hardware/samd/1.8.3).

Supposing the Seeeduino SAMD core version is 1.8.3. These files must be copied into the directory:

  • ~/.arduino15/packages/Seeeduino/hardware/samd/1.8.3/platform.txt
  • ~/.arduino15/packages/Seeeduino/hardware/samd/1.8.3/cores/arduino/Arduino.h
  • ~/.arduino15/packages/Seeeduino/hardware/samd/1.8.3/cores/arduino/Print.h
  • ~/.arduino15/packages/Seeeduino/hardware/samd/1.8.3/cores/arduino/Print.cpp

Whenever a new version is installed, remember to copy this file into the new version directory. For example, new version is x.yy.zz These files must be copied into the directory:

  • ~/.arduino15/packages/Seeeduino/hardware/samd/x.yy.zz/platform.txt
  • ~/.arduino15/packages/Seeeduino/hardware/samd/x.yy.zz/cores/arduino/Arduino.h
  • ~/.arduino15/packages/Seeeduino/hardware/samd/x.yy.zz/cores/arduino/Print.h
  • ~/.arduino15/packages/Seeeduino/hardware/samd/x.yy.zz/cores/arduino/Print.cpp

7. For STM32 boards

7.1 For STM32 boards to use LAN8720

For Generic STM32F4 series boards, such as STM32F407VE, using LAN8720, please use STM32 core v2.2.0 as breaking core v2.3.0 creates the compile error.


To use LAN8720 on some STM32 boards

  • Nucleo-144 (F429ZI, NUCLEO_F746NG, NUCLEO_F746ZG, NUCLEO_F756ZG)
  • Discovery (DISCO_F746NG)
  • STM32F4 boards (BLACK_F407VE, BLACK_F407VG, BLACK_F407ZE, BLACK_F407ZG, BLACK_F407VE_Mini, DIYMORE_F407VGT, FK407M1)

you have to copy the files stm32f4xx_hal_conf_default.h and stm32f7xx_hal_conf_default.h into STM32 stm32 directory (~/.arduino15/packages/STM32/hardware/stm32/2.3.0/system) to overwrite the old files.

Supposing the STM32 stm32 core version is 2.3.0. These files must be copied into the directory:

  • ~/.arduino15/packages/STM32/hardware/stm32/2.3.0/system/STM32F4xx/stm32f4xx_hal_conf_default.h for STM32F4.
  • ~/.arduino15/packages/STM32/hardware/stm32/2.3.0/system/STM32F7xx/stm32f7xx_hal_conf_default.h for Nucleo-144 STM32F7.

Whenever a new version is installed, remember to copy this file into the new version directory. For example, new version is x.yy.zz, these files must be copied into the corresponding directory:

  • ~/.arduino15/packages/STM32/hardware/stm32/x.yy.zz/system/STM32F4xx/stm32f4xx_hal_conf_default.h
  • `~/.arduino15/packages/STM32/hardware/stm32/x.yy.zz/system/STM32F7xx/stm32f7xx_hal_conf_default.h

7.2 For STM32 boards to use Serial1

To use Serial1 on some STM32 boards without Serial1 definition (Nucleo-144 NUCLEO_F767ZI, Nucleo-64 NUCLEO_L053R8, etc.) boards, you have to copy the files STM32 variant.h into STM32 stm32 directory (~/.arduino15/packages/STM32/hardware/stm32/2.3.0). You have to modify the files corresponding to your boards, this is just an illustration how to do.

Supposing the STM32 stm32 core version is 2.3.0. These files must be copied into the directory:

  • ~/.arduino15/packages/STM32/hardware/stm32/2.3.0/variants/STM32F7xx/F765Z(G-I)T_F767Z(G-I)T_F777ZIT/NUCLEO_F767ZI/variant.h for Nucleo-144 NUCLEO_F767ZI.
  • ~/.arduino15/packages/STM32/hardware/stm32/2.3.0/variants/STM32L0xx/L052R(6-8)T_L053R(6-8)T_L063R8T/NUCLEO_L053R8/variant.h for Nucleo-64 NUCLEO_L053R8.

Whenever a new version is installed, remember to copy this file into the new version directory. For example, new version is x.yy.zz, these files must be copied into the corresponding directory:

  • ~/.arduino15/packages/STM32/hardware/stm32/x.yy.zz/variants/STM32F7xx/F765Z(G-I)T_F767Z(G-I)T_F777ZIT/NUCLEO_F767ZI/variant.h
  • ~/.arduino15/packages/STM32/hardware/stm32/x.yy.zz/variants/STM32L0xx/L052R(6-8)T_L053R(6-8)T_L063R8T/NUCLEO_L053R8/variant.h

8. For RP2040-based boards using Earle Philhower arduino-pico core

8.1 To use BOARD_NAME

To be able to automatically detect and display BOARD_NAME on RP2040-based boards (RASPBERRY_PI_PICO, ADAFRUIT_FEATHER_RP2040, GENERIC_RP2040, etc) boards, you have to copy the file RP2040 platform.txt into rp2040 directory (~/.arduino15/packages/rp2040/hardware/rp2040/1.4.0).

Supposing the rp2040 core version is 1.4.0. This file must be copied into the directory:

  • ~/.arduino15/packages/rp2040/hardware/rp2040/1.4.0/platform.txt

Whenever a new version is installed, remember to copy this file into the new version directory. For example, new version is x.yy.zz This file must be copied into the directory:

  • ~/.arduino15/packages/rp2040/hardware/rp2040/x.yy.zz/platform.txt

With core after v1.5.0, this step is not necessary anymore thanks to the PR Add -DBOARD_NAME="{build.board}" #136.

8.2 To avoid compile error relating to microsecondsToClockCycles

Some libraries, such as Adafruit DHT-sensor-library, require the definition of microsecondsToClockCycles(). To be able to compile and run on RP2040-based boards, you have to copy the files in RP2040 Arduino.h into rp2040 directory (~/.arduino15/packages/rp2040/hardware/rp2040/1.4.0).

Supposing the rp2040 core version is 1.4.0. This file must be copied to replace:

  • ~/.arduino15/packages/rp2040/hardware/rp2040/1.4.0/cores/rp2040/Arduino.h

Whenever a new version is installed, remember to copy this file into the new version directory. For example, new version is x.yy.zz This file must be copied to replace:

  • ~/.arduino15/packages/rp2040/hardware/rp2040/x.yy.zz/cores/rp2040/Arduino.h

With core after v1.5.0, this step is not necessary anymore thanks to the PR Add defs for compatibility #142.

9. For Portenta_H7 boards using Arduino IDE in Linux

To be able to upload firmware to Portenta_H7 using Arduino IDE in Linux (Ubuntu, etc.), you have to copy the file portenta_post_install.sh into mbed_portenta directory (~/.arduino15/packages/arduino/hardware/mbed_portenta/3.4.1/portenta_post_install.sh).

Then run the following command using sudo

$ cd ~/.arduino15/packages/arduino/hardware/mbed_portenta/3.4.1
$ chmod 755 portenta_post_install.sh
$ sudo ./portenta_post_install.sh

This will create the file /etc/udev/rules.d/49-portenta_h7.rules as follows:

# Portenta H7 bootloader mode UDEV rules

SUBSYSTEMS=="usb", ATTRS{idVendor}=="2341", ATTRS{idProduct}=="035b", GROUP="plugdev", MODE="0666"

Supposing the ArduinoCore-mbed core version is 3.4.1. Now only one file must be copied into the directory:

  • ~/.arduino15/packages/arduino/hardware/mbed_portenta/3.4.1/portenta_post_install.sh

Whenever a new version is installed, remember to copy this files into the new version directory. For example, new version is x.yy.zz

This file must be copied into the directory:

  • ~/.arduino15/packages/arduino/hardware/mbed_portenta/x.yy.zz/portenta_post_install.sh

10. For RTL8720DN boards using AmebaD core

To avoid compile error relating to PROGMEM, you have to copy the file Realtek AmebaD core pgmspace.h into Realtek AmebaD directory (~/.arduino15/packages/realtek/hardware/AmebaD/3.1.4/cores/ambd/avr/pgmspace.h).

Supposing the Realtek AmebaD core version is 3.1.4. This file must be copied into the directory:

  • ~/.arduino15/packages/realtek/hardware/AmebaD/3.1.4/cores/ambd/avr/pgmspace.h

Whenever a new version is installed, remember to copy this file into the new version directory. For example, new version is x.yy.zz This file must be copied into the directory:

  • ~/.arduino15/packages/realtek/hardware/AmebaD/x.yy.zz/cores/ambd/avr/pgmspace.h

11. For SAMD21 and SAMD51 boards using ArduinoCore-fab-sam core

To avoid compile error relating to SAMD21/SAMD51, you have to copy the file ArduinoCore-fab-sam core pgmspace.h into ArduinoCore-fab-sam samd directory (~/.arduino15/packages/Fab_SAM_Arduino/hardware/samd/1.9.0/boards.txt).

Supposing the ArduinoCore-fab-sam samd core version is 1.9.0. This file must be copied into the directory:

  • ~/.arduino15/packages/Fab_SAM_Arduino/hardware/samd/1.9.0/boards.txt

Whenever a new version is installed, remember to copy this file into the new version directory. For example, new version is x.yy.zz This file must be copied into the directory:

  • ~/.arduino15/packages/Fab_SAM_Arduino/hardware/samd/x.yy.zz/boards.txt

12. For Seeeduino RP2040 boards

To be able to compile, run and automatically detect and display BOARD_NAME on Seeeduino RP2040 (XIAO RP2040, Wio RP2040 Mini) boards, you have to copy the whole Seeeduino RP2040 Packages_Patches directory into Seeeduino samd directory (~/.arduino15/packages/Seeeduino/hardware/rp2040/2.7.2).

Supposing the Seeeduino RP2040 core version is 2.7.2. These files must be copied into the directory:

  • ~/.arduino15/packages/Seeeduino/hardware/rp2040/2.7.2/boards.txt
  • ~/.arduino15/packages/Seeeduino/hardware/rp2040/2.7.2/variants/Seeed_XIAO_RP2040/pins_arduino.h

Whenever a new version is installed, remember to copy this file into the new version directory. For example, new version is x.yy.zz These files must be copied into the directory:

  • ~/.arduino15/packages/Seeeduino/hardware/samd/x.yy.zz/boards.txt
  • ~/.arduino15/packages/Seeeduino/hardware/samd/x.yy.zz/variants/Seeed_XIAO_RP2040/pins_arduino.h

13. For Seeeduino nRF52840 boards

To be able to compile and run on Xiao nRF52840 boards, you have to copy the whole nRF52 1.0.0 directory into Seeeduino nRF52 directory (~/.arduino15/packages/Seeeduino/hardware/nrf52/1.0.0).

Supposing the Seeeduino nRF52 version is 1.0.0. These files must be copied into the directory:

  • ~/.arduino15/packages/Seeeduino/hardware/nrf52/1.0.0/platform.txt
  • ~/.arduino15/packages/Seeeduino/hardware/nrf52/1.0.0/cores/nRF5/Print.h
  • ~/.arduino15/packages/Seeeduino/hardware/nrf52/1.0.0/cores/nRF5/Print.cpp
  • ~/.arduino15/packages/Seeeduino/hardware/nrf52/1.0.0/cores/nRF5/Udp.h

Whenever a new version is installed, remember to copy these files into the new version directory. For example, new version is x.yy.z These files must be copied into the directory:

  • ~/.arduino15/packages/Seeeduino/hardware/nrf52/x.yy.z/platform.txt
  • ~/.arduino15/packages/Seeeduino/hardware/nrf52/x.yy.z/cores/nRF5/Print.h
  • ~/.arduino15/packages/Seeeduino/hardware/nrf52/x.yy.z/cores/nRF5/Print.cpp
  • ~/.arduino15/packages/Seeeduino/hardware/nrf52/x.yy.z/cores/nRF5/Udp.h


Libraries' Patches

1. For application requiring 2K+ HTML page

If your application requires 2K+ HTML page, the current Ethernet library must be modified if you are using W5200/W5500 Ethernet shields. W5100 is not supported for 2K+ buffer. If you use boards requiring different CS/SS pin for W5x00 Ethernet shield, for example ESP32, ESP8266, nRF52, etc., you also have to modify the following libraries to be able to specify the CS/SS pin correctly.

2. For Ethernet library

To fix Ethernet library, just copy these following files into the Ethernet library directory to overwrite the old files:

You can also use the forked and modified library at Patched Ethernet

3. For EthernetLarge library

To fix EthernetLarge library, just copy these following files into the EthernetLarge library directory to overwrite the old files:

You can also use the forked and modified library at Patched EthernetLarge

4. For Ethernet2 library

To fix Ethernet2 library, just copy these following files into the Ethernet2 library directory to overwrite the old files:

To add UDP Multicast support, necessary for the UPnP_Generic library:

You can also use the forked and modified library at Patched Ethernet2

5. For Ethernet3 library

  1. To fix Ethernet3 library, just copy these following files into the Ethernet3 library directory to overwrite the old files:

You can also use the forked and modified library at Patched Ethernet3

6. For UIPEthernet library

To be able to compile and run on nRF52 boards with ENC28J60 using UIPEthernet library, you have to copy these following files into the UIPEthernet utility directory to overwrite the old files:

7. For fixing ESP32 compile error

To fix ESP32 compile error, just copy the following file into the ESP32 cores/esp32 directory (e.g. ./arduino-1.8.19/hardware/espressif/cores/esp32) to overwrite the old file:

8. For fixing ESP8266 compile error

To fix ESP8266 compile error such as

error: 'class EthernetClass' has no member named 'init'
Ethernet.init (USE_THIS_SS_PIN);

just rename the following file in ./arduino-1.8.19/hardware/esp8266com/esp8266/libraries/Ethernet directory

  • From Ethernet.h to Ethernet_ESP8266.h


HOWTO Use analogRead() with ESP32 running WiFi and/or BlueTooth (BT/BLE)

Please have a look at ESP_WiFiManager Issue 39: Not able to read analog port when using the autoconnect example to have more detailed description and solution of the issue.

1. ESP32 has 2 ADCs, named ADC1 and ADC2

2. ESP32 ADCs functions

  • ADC1 controls ADC function for pins GPIO32-GPIO39
  • ADC2 controls ADC function for pins GPIO0, 2, 4, 12-15, 25-27

3.. ESP32 WiFi uses ADC2 for WiFi functions

Look in file adc_common.c

In ADC2, there're two locks used for different cases:

  1. lock shared with app and Wi-Fi: ESP32: When Wi-Fi using the ADC2, we assume it will never stop, so app checks the lock and returns immediately if failed. ESP32S2: The controller's control over the ADC is determined by the arbiter. There is no need to control by lock.

  2. lock shared between tasks: when several tasks sharing the ADC2, we want to guarantee all the requests will be handled. Since conversions are short (about 31us), app returns the lock very soon, we use a spinlock to stand there waiting to do conversions one by one.

adc2_spinlock should be acquired first, then adc2_wifi_lock or rtc_spinlock.

  • In order to use ADC2 for other functions, we have to acquire complicated firmware locks and very difficult to do
  • So, it's not advisable to use ADC2 with WiFi/BlueTooth (BT/BLE).
  • Use ADC1, and pins GPIO32-GPIO39
  • If somehow it's a must to use those pins serviced by ADC2 (GPIO0, 2, 4, 12, 13, 14, 15, 25, 26 and 27), use the fix mentioned at the end of ESP_WiFiManager Issue 39: Not able to read analog port when using the autoconnect example to work with ESP32 WiFi/BlueTooth (BT/BLE).


Configuration Notes

1. How to select which built-in Ethernet or shield to use

The easiest way is to use

#define USE_ETHERNET_WRAPPER    true

then select one and only one Ethernet library to use as follows:

  • Standard W5x00/W5100S/W6100 Ethernet_Generic library is used by default, in the sketch, just be sure to comment out or leave these #defines to be false :
// Only one if the following to be true
#define USE_UIP_ETHERNET          false
#define USE_ETHERNET_PORTENTA_H7  false
#define USE_NATIVE_ETHERNET       false
#define USE_QN_ETHERNET           false
#define USE_ETHERNET_GENERIC      false
#define USE_ETHERNET_ESP8266      false 
#define USE_ETHERNET_ENC          false
#define USE_CUSTOM_ETHERNET       false

To use W5x00/W5100S/W6100 Ethernet, for example using Ethernet_Generic library

// Only one if the following to be true
#define USE_UIP_ETHERNET          false
#define USE_ETHERNET_PORTENTA_H7  false
#define USE_NATIVE_ETHERNET       false
#define USE_QN_ETHERNET           false
#define USE_ETHERNET_GENERIC      true
#define USE_ETHERNET_ESP8266      false
#define USE_ETHERNET_ENC          false
#define USE_CUSTOM_ETHERNET       false
  • To use ENC28J60 Ethernet, using EthernetENC library (NEW and Better)
// Only one if the following to be true
#define USE_UIP_ETHERNET          false
#define USE_ETHERNET_PORTENTA_H7  false
#define USE_NATIVE_ETHERNET       false
#define USE_QN_ETHERNET           false
#define USE_ETHERNET_GENERIC      false
#define USE_ETHERNET_ESP8266      false
#define USE_ETHERNET_ENC          true
#define USE_CUSTOM_ETHERNET       false
  • To use ENC28J60 Ethernet, using UIPEthernet library:
// Only one if the following to be true
#define USE_UIP_ETHERNET          true
#define USE_ETHERNET_PORTENTA_H7  false
#define USE_NATIVE_ETHERNET       false
#define USE_QN_ETHERNET           false
#define USE_ETHERNET_GENERIC      false
#define USE_ETHERNET_ESP8266      false 
#define USE_ETHERNET_ENC          false
#define USE_CUSTOM_ETHERNET       false
  • To use another Ethernet library For example, EthernetLarge library
// Only one if the following to be true
#define USE_UIP_ETHERNET          false
#define USE_ETHERNET_PORTENTA_H7  false
#define USE_NATIVE_ETHERNET       false
#define USE_QN_ETHERNET           false
#define USE_ETHERNET_GENERIC      false
#define USE_ETHERNET_ESP8266      false 
#define USE_ETHERNET_ENC          false
#define USE_CUSTOM_ETHERNET       true

//Must be placed before #include <EthernetWebServer.h>
#include <EthernetLarge.h>
...

#include <EthernetWebServer.h>
  • Only for Teensy 4.1, to use NativeEthernet library
#if defined(__IMXRT1062__)
  // For Teensy 4.1/4.0
  #if defined(ARDUINO_TEENSY41)
    #define BOARD_TYPE      "TEENSY 4.1"
    // Use true for NativeEthernet Library, false if using other Ethernet libraries
    #define USE_NATIVE_ETHERNET     true
    #define USE_QN_ETHERNET         false
  #elif defined(ARDUINO_TEENSY40)
    #define BOARD_TYPE      "TEENSY 4.0"
  #else
    #define BOARD_TYPE      "TEENSY 4.x"
  #endif      
#elif defined(__MK66FX1M0__)
  ....
  • Only for Teensy 4.1, to use another Ethernet library, for example Ethernet_Generic library
#if defined(__IMXRT1062__)
  // For Teensy 4.1/4.0
  #if defined(ARDUINO_TEENSY41)
    #define BOARD_TYPE      "TEENSY 4.1"
    // Use true for NativeEthernet Library, false if using other Ethernet libraries
    #define USE_NATIVE_ETHERNET     false
    #define USE_QN_ETHERNET         false
  #elif defined(ARDUINO_TEENSY40)
    #define BOARD_TYPE      "TEENSY 4.0"
  #else
    #define BOARD_TYPE      "TEENSY 4.x"
  #endif      
#elif defined(__MK66FX1M0__)
  ....
  
#define USE_UIP_ETHERNET        false

// Only one if the following to be true
#define USE_ETHERNET_GENERIC    true
#define USE_ETHERNET_ESP8266    false
#define USE_ETHERNET_ENC        false
#define USE_CUSTOM_ETHERNET     false  
  • Only for Teensy 4.1, to use QNEthernet library
#if ( defined(CORE_TEENSY) && defined(__IMXRT1062__) && defined(ARDUINO_TEENSY41) ) 
  // For Teensy 4.1
  #define BOARD_TYPE      "TEENSY 4.1"
  // Use true for NativeEthernet Library, false if using other Ethernet libraries
  #define USE_NATIVE_ETHERNET     false
  #define USE_QN_ETHERNET         true
#else
  #error Only Teensy 4.1 supported
#endif

#define USE_ETHERNET_WRAPPER    false

// Use true  for ENC28J60 and UIPEthernet library (https://github.com/UIPEthernet/UIPEthernet)
// Use false for W5x00 and Ethernetx library      (https://www.arduino.cc/en/Reference/Ethernet)

#define USE_UIP_ETHERNET        false
#define USE_ETHERNET_GENERIC    false
#define USE_ETHERNET_ESP8266    false 
#define USE_ETHERNET_ENC        false
#define USE_CUSTOM_ETHERNET     false

#if USE_NATIVE_ETHERNET
  #include "NativeEthernet.h"
  #warning Using NativeEthernet lib for Teensy 4.1. Must also use Teensy Packages Patch or error
  #define SHIELD_TYPE           "using NativeEthernet"
#elif USE_QN_ETHERNET
  #include "QNEthernet.h"
  using namespace qindesign::network;
  #warning Using QNEthernet lib for Teensy 4.1. Must also use Teensy Packages Patch or error
  #define SHIELD_TYPE           "using QNEthernet"  
#endif 

Important:

  • The Ethernet_Shield_W5200, EtherCard, EtherSia libraries are not supported. Don't use unless you know how to modify those libraries.
  • Requests to support for any future custom Ethernet library will be ignored. Use at your own risk.

2. How to select another CS/SS pin to use

The default CS/SS pin is GPIO4(D2) for ESP8266, GPIO22 for ESP32, 10 for all other boards.

If the default pin is not correct, the easiest way is to select the CS/SS pin (e.g. 22) to use as follows:

// To override the default CS/SS pin. Don't use unless you know exactly which pin to use
#define USE_THIS_SS_PIN   22

3. How to use W5x00 with ESP8266

To avoid using the default but not-working Ethernet library of ESP8266, rename the Ethernet.h/cpp to Ethernet_ESP8266.h/cpp to avoid library conflict if you're using the Arduino Ethernet library. The Ethernet_Generic, Ethernet2, Ethernet3, EthernetLarge library can be used without conflict.

These pins are tested OK with ESP8266 and W5x00/W5100S/W6100

// For ESP8266
// Pin                D0(GPIO16)    D1(GPIO5)    D2(GPIO4)    D3(GPIO0)    D4(GPIO2)    D8
// Ethernet           0                 X            X            X            X        0
// Ethernet2          X                 X            X            X            X        0
// Ethernet3          X                 X            X            X            X        0
// EthernetLarge      X                 X            X            X            X        0
// Ethernet_ESP8266   0                 0            0            0            0        0
// D2 is safe to used for Ethernet, Ethernet2, Ethernet3, EthernetLarge libs
// Must use library patch for Ethernet, EthernetLarge libraries
//Ethernet.setCsPin (USE_THIS_SS_PIN);
Ethernet.init (USE_THIS_SS_PIN);

4. How to increase W5x00 TX/RX buffer

  • For Ethernet_Generic library only, simply use as follows to have large buffer similar to EthernetLarge library
#define ETHERNET_LARGE_BUFFERS
  • For Ethernet3 library only, use as follows
// Use  MAX_SOCK_NUM = 4 for 4K, 2 for 8K, 1 for 16K RX/TX buffer
#ifndef ETHERNET3_MAX_SOCK_NUM
  #define ETHERNET3_MAX_SOCK_NUM      4
#endif

Ethernet.setCsPin (USE_THIS_SS_PIN);
Ethernet.init (ETHERNET3_MAX_SOCK_NUM);

5. How to adjust sendContent_P() and send_P() buffer size

sendContent_P() and send_P() buffer size is set default at 4 Kbytes, and minimum is 256 bytes. If you need to change, just add a definition, e.g.:

#define SENDCONTENT_P_BUFFER_SZ     2048

Note that the buffer size must be larger than 256 bytes. See Sending GZIP HTML ~ 120kb+ (suggested enhancement).

6. How to use SPI2 for ESP32 using W5x00 and Ethernet_Generic Library

#define USING_SPI2                          true

Pin to use for SPI2

MOSI:  13
MISO:  12
SCK:   14
SS:    5

7. How to use SPI1 for RP2040 using W5x00 and Ethernet_Generic Library

#define USING_SPI2                          true

Pin to use for SPI1

MOSI:  15
MISO:  12
SCK:   14
SS:    13

8. How to use SPI1/SPI2 for Teensy 4.x using W5x00 and Ethernet_Generic Library

#include <SPI.h>

  // For RPI Pico using Mbed RP2040 core
#if (USING_SPI2)
  #define USING_CUSTOM_SPI          true

  // Teensy4.1
  // SCK1: 27,  MOSI1: 26, MISO1:  1, SS1/CS1:  0 for SPI1
  // SCK2: 45,  MOSI2: 43, MISO2: 32, SS2/CS2: 44 for SPI2
  // Teensy4.0, in the back, untested
  // SCK1: 27,  MOSI1: 26, MISO1: 1, SS1/CS1: 0 for SPI1
  #define CUR_PIN_MISO              1
  #define CUR_PIN_MOSI              26
  #define CUR_PIN_SCK               27
  #define CUR_PIN_SS                0

  #define SPI_NEW_INITIALIZED       true

  // SPI1
  SPIClass SPI_New((uintptr_t)&IMXRT_LPSPI3_S, (uintptr_t)&SPIClass::spiclass_lpspi3_hardware);
  // SPI2
  //SPIClass SPI_New((uintptr_t)&IMXRT_LPSPI1_S, (uintptr_t)&SPIClass::spiclass_lpspi1_hardware);
  
  #warning Using USE_THIS_SS_PIN = CUR_PIN_SS = 38

  #if defined(USE_THIS_SS_PIN)
    #undef USE_THIS_SS_PIN
  #endif   
  #define USE_THIS_SS_PIN       CUR_PIN_SS

#endif  

Pin to use for SPI1

MOSI:  26
MISO:   1
SCK:   27
SS:     0

Pin to use for SPI2

MOSI:  43
MISO:  32
SCK:   45
SS:    44

9. Important Note for AVRDx using Arduino IDE

With some Arduino IDE versions, such as v1.8.19, upload directly via USB to some boards, such as Curiosity_AVR128DA48 or Curiosity_AVR128DB48 can't be done without unknown-to-me fix. We'll get the following error when uploading

avrdude: Version 6.3-20201216
     Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
     Copyright (c) 2007-2014 Joerg Wunsch

     System wide configuration file is "/home/kh/.arduino15/packages/DxCore/hardware/megaavr/1.4.10/avrdude.conf"
     User configuration file is "/home/kh/.avrduderc"
     User configuration file does not exist or is not a regular file, skipping

     Using Port                    : usb
     Using Programmer              : curiosity_updi
avrdude: usbdev_open(): Found nEDBG CMSIS-DAP, serno: MCHP3280041800002682
avrdude: usbdev_open(): WARNING: failed to set configuration 1: Device or resource busy
avrdude: Found CMSIS-DAP compliant device, using EDBG protocol
avrdude: usbdev_send(): wrote -5 out of 912 bytes, err = Input/output error
avrdude: jtag3_edbg_prepare(): failed to send command to serial port

avrdude done.  Thank you.

the selected serial port 
 does not exist or your board is not connected

We can use drag-and-drop method to drag-and-drop the compiled hex file to CURIOSITY virtual drive.

If success, The LED blinks slowly for 2 sec. The LED will blinks rapidly for 2 sec if failure

For example, to run Change_Interval example, use Arduino IDE to compile, and get the Change_Interval.ino.hex file. For Ubuntu Linux, the file is stored in directory /tmp/arduino_build_xxxxxx

After drag-and-drop the Change_Interval.ino.hex into CURIOSITY virtual drive, the code will run immediately if successfully loaded (LED blinks slowly)

How to connect W5x00 to AVDDx

This is example to demo how to connect W5x00/W5100S/W6100 to Curiosity AVR128DA48 or AVR128DB48

W5x00 <---> AVRDx
MOSI <---> PA_4 = 4
MISO <---> PA_5 = 5
SCK <---> PA_6 = 6
SS <---> PA_7 = 7
GND <---> GND = 52
3.3V <---> VCC = 51



Usage

Init the CS/SS pin if use EthernetWrapper

EthernetInit();

Class Constructor

EthernetWebServer server(80);

Creates the EthernetWebServer class object.

Parameters:

host port number: int port (default is the standard HTTP port 80)

Basic Operations

Starting the server

void begin();

Handling incoming client requests

void handleClient();

Disabling the server

void close();
void stop();

Both methods function the same

Client request handlers

void on();
void addHandler();
void onNotFound();
void onFileUpload();	

Example:

server.on("/", handlerFunction);
server.onNotFound(handlerFunction);   // called when handler is not assigned
server.onFileUpload(handlerFunction); // handle file uploads

Sending responses to the client

void send();
void send_P();

Parameters:

code - HTTP response code, can be 200 or 404, etc.

content_type - HTTP content type, like "text/plain" or "image/png", etc.

content - actual content body

Advanced Options

Getting information about request arguments

const String & arg();
const String & argName();
int args();
bool hasArg();

Function usage:

arg - get request argument value, use arg("plain") to get POST body

argName - get request argument name

args - get arguments count

hasArg - check if argument exist

Getting information about request headers

const String & header();
const String & headerName();
const String & hostHeader();
int headers();
bool hasHeader();

Function usage:

header - get request header value

headerName - get request header name

hostHeader - get request host header if available, else empty string

headers - get header count

hasHeader - check if header exist

Authentication

bool authenticate();
void requestAuthentication();

Function usage:

authenticate - server authentication, returns true if client is authenticated else false

requestAuthentication - sends authentication failure response to the client

Example Usage:

if(!server.authenticate(username, password))
{
  server.requestAuthentication();
}

Other Function Calls

const String & uri(); // get the current uri
HTTPMethod  method(); // get the current method 
WiFiClient client(); // get the current client
HTTPUpload & upload(); // get the current upload
void setContentLength(); // set content length
void sendHeader(); // send HTTP header
void sendContent(); // send content
void sendContent_P(); 
void collectHeaders(); // set the request headers to collect
void serveStatic();
size_t streamFile();


Examples:

Original Examples

  1. AdvancedWebServer
  2. SimpleWebServer_NativeEthernet
  3. HelloServer
  4. HelloServer2
  5. HttpBasicAuth
  6. MQTTClient_Auth
  7. MQTTClient_Basic
  8. MQTT_ThingStream
  9. PostServer
  10. SimpleAuthentication
  11. UdpNTPClient
  12. UdpSendReceive
  13. WebClient
  14. WebClient_ESP
  15. WebClientRepeating
  16. WebClientRepeating_ESP
  17. WebServer
  18. WebServer_NativeEthernet
  19. ESP32_FS_EthernetWebServer.
  20. FS_EthernetWebServer.
  21. serveStatic.
  22. serveStaticLoadFile.
  23. AdvancedWebServer_Ptr. New
  24. multiFileProject. New
  25. EthernetWebServer_BigData. New

HTTP and WebSocket Client New Examples

  1. BasicAuthGet
  2. CustomHeader
  3. DweetGet
  4. DweetPost
  5. HueBlink
  6. node_test_server
  7. PostWithHeaders
  8. SimpleDelete
  9. SimpleGet
  10. SimpleHTTPExample
  11. SimplePost
  12. SimplePut
  13. SimpleWebSocket

New Examples for Teensy 4.1 QNEthernet

  1. AdvancedWebServer
  2. MQTTClient_Auth
  3. MQTTClient_Basic
  4. MQTT_ThingStream

New Examples for ESP32 and ESP8266 using with WebServer or ESP8266WebServer

  1. WiFi_Ethernet_Complex_ESP32
  2. WiFi_Ethernet_Complex_ESP8266

New Examples for ESP32 using SPI2

  1. AdvancedWebServer_ESP32_SPI2 New

New Examples for SPI1/SPI2

  1. AdvancedWebServer_RP2040_SPI1 New
  2. AdvancedWebServer_Teensy4x_SPI1 New


#include "defines.h"
EthernetWebServer server(80);
int reqCount = 0; // number of requests received
void handleRoot()
{
#define BUFFER_SIZE 512
char temp[BUFFER_SIZE];
int sec = millis() / 1000;
int min = sec / 60;
int hr = min / 60;
int day = hr / 24;
hr = hr % 24;
snprintf(temp, BUFFER_SIZE - 1,
"<html>\
<head>\
<meta http-equiv='refresh' content='5'/>\
<title>%s</title>\
<style>\
body { background-color: #cccccc; font-family: Arial, Helvetica, Sans-Serif; Color: #000088; }\
</style>\
</head>\
<body>\
<h1>Hello from %s</h1>\
<h3>running EthernetWebServer</h3>\
<h3>on %s</h3>\
<p>Uptime: %d d %02d:%02d:%02d</p>\
<img src=\"/test.svg\" />\
</body>\
</html>", BOARD_NAME, BOARD_NAME, SHIELD_TYPE, day, hr, min % 60, sec % 60);
server.send(200, F("text/html"), temp);
}
void handleNotFound()
{
String message = F("File Not Found\n\n");
message += F("URI: ");
message += server.uri();
message += F("\nMethod: ");
message += (server.method() == HTTP_GET) ? F("GET") : F("POST");
message += F("\nArguments: ");
message += server.args();
message += F("\n");
for (uint8_t i = 0; i < server.args(); i++)
{
message += " " + server.argName(i) + ": " + server.arg(i) + "\n";
}
server.send(404, F("text/plain"), message);
}
#define ORIGINAL_STR_LEN (2048 * MULTIPLY_FACTOR)
void drawGraph()
{
static String out;
static uint16_t previousStrLen = ORIGINAL_STR_LEN;
if (out.length() == 0)
{
ET_LOGWARN1(F("String Len = 0, extend to"), ORIGINAL_STR_LEN);
out.reserve(ORIGINAL_STR_LEN);
}
#if (MULTIPLY_FACTOR == 2)
out = F( "<svg xmlns=\"http://www.w3.org/2000/svg\" version=\"1.1\" width=\"610\" height=\"150\">\n" \
"<rect width=\"610\" height=\"150\" fill=\"rgb(250, 230, 210)\" stroke-width=\"3\" stroke=\"rgb(0, 0, 0)\" />\n" \
"<g stroke=\"blue\">\n");
#elif (MULTIPLY_FACTOR == 4)
out = F( "<svg xmlns=\"http://www.w3.org/2000/svg\" version=\"1.1\" width=\"1210\" height=\"150\">\n" \
"<rect width=\"1210\" height=\"150\" fill=\"rgb(250, 230, 210)\" stroke-width=\"3\" stroke=\"rgb(0, 0, 0)\" />\n" \
"<g stroke=\"blue\">\n");
#elif (MULTIPLY_FACTOR == 6)
out = F( "<svg xmlns=\"http://www.w3.org/2000/svg\" version=\"1.1\" width=\"1810\" height=\"150\">\n" \
"<rect width=\"1810\" height=\"150\" fill=\"rgb(250, 230, 210)\" stroke-width=\"3\" stroke=\"rgb(0, 0, 0)\" />\n" \
"<g stroke=\"blue\">\n");
#else // (MULTIPLY_FACTOR == 1)
out = F( "<svg xmlns=\"http://www.w3.org/2000/svg\" version=\"1.1\" width=\"310\" height=\"150\">\n" \
"<rect width=\"310\" height=\"150\" fill=\"rgb(250, 230, 210)\" stroke-width=\"3\" stroke=\"rgb(0, 0, 0)\" />\n" \
"<g stroke=\"blue\">\n");
#endif
char temp[70];
int y = rand() % 130;
//for (int x = 10; x < 300; x += 10)
for (int x = 10; x < (300 * MULTIPLY_FACTOR); x += 10)
{
int y2 = rand() % 130;
sprintf(temp, "<line x1=\"%d\" y1=\"%d\" x2=\"%d\" y2=\"%d\" stroke-width=\"2\" />\n", x, 140 - y, x + 10, 140 - y2);
out += temp;
y = y2;
}
out += F("</g>\n</svg>\n");
ET_LOGERROR1(F("String Len = "), out.length());
if (out.length() > previousStrLen)
{
ET_LOGERROR3(F("String Len > "), previousStrLen, F(", extend to"), out.length() + 48);
previousStrLen = out.length() + 48;
out.reserve(previousStrLen);
}
else
{
server.send(200, "image/svg+xml", out);
}
}
void initEthernet()
{
#if USE_ETHERNET_PORTENTA_H7
ET_LOGWARN(F("======== USE_PORTENTA_H7_ETHERNET ========"));
#elif USE_NATIVE_ETHERNET
ET_LOGWARN(F("======== USE_NATIVE_ETHERNET ========"));
#elif USE_ETHERNET_GENERIC
ET_LOGWARN(F("=========== USE_ETHERNET_GENERIC ==========="));
#elif USE_ETHERNET_ESP8266
ET_LOGWARN(F("=========== USE_ETHERNET_ESP8266 ==========="));
#elif USE_ETHERNET_ENC
ET_LOGWARN(F("=========== USE_ETHERNET_ENC ==========="));
#else
ET_LOGWARN(F("========================="));
#endif
#if !(USE_NATIVE_ETHERNET || USE_ETHERNET_PORTENTA_H7)
#if (USING_SPI2)
#if defined(CUR_PIN_MISO)
ET_LOGWARN(F("Default SPI pinout:"));
ET_LOGWARN1(F("MOSI:"), CUR_PIN_MOSI);
ET_LOGWARN1(F("MISO:"), CUR_PIN_MISO);
ET_LOGWARN1(F("SCK:"), CUR_PIN_SCK);
ET_LOGWARN1(F("SS:"), CUR_PIN_SS);
ET_LOGWARN(F("========================="));
#endif
#else
ET_LOGWARN(F("Default SPI pinout:"));
ET_LOGWARN1(F("MOSI:"), MOSI);
ET_LOGWARN1(F("MISO:"), MISO);
ET_LOGWARN1(F("SCK:"), SCK);
ET_LOGWARN1(F("SS:"), SS);
ET_LOGWARN(F("========================="));
#endif
#if defined(ESP8266)
// For ESP8266, change for other boards if necessary
#ifndef USE_THIS_SS_PIN
#define USE_THIS_SS_PIN D2 // For ESP8266
#endif
ET_LOGWARN1(F("ESP8266 setCsPin:"), USE_THIS_SS_PIN);
#if ( USE_ETHERNET_GENERIC || USE_ETHERNET_ENC )
// For ESP8266
// Pin D0(GPIO16) D1(GPIO5) D2(GPIO4) D3(GPIO0) D4(GPIO2) D8
// EthernetGeneric X X X X X 0
// Ethernet_ESP8266 0 0 0 0 0 0
// D2 is safe to used for Ethernet, Ethernet2, Ethernet3, EthernetLarge libs
// Must use library patch for Ethernet, EthernetLarge libraries
Ethernet.init (USE_THIS_SS_PIN);
#elif USE_CUSTOM_ETHERNET
// You have to add initialization for your Custom Ethernet here
// This is just an example to setCSPin to USE_THIS_SS_PIN, and can be not correct and enough
Ethernet.init(USE_THIS_SS_PIN);
#endif //( USE_ETHERNET_GENERIC || USE_ETHERNET_ENC )
#elif defined(ESP32)
// You can use Ethernet.init(pin) to configure the CS pin
//Ethernet.init(10); // Most Arduino shields
//Ethernet.init(5); // MKR ETH shield
//Ethernet.init(0); // Teensy 2.0
//Ethernet.init(20); // Teensy++ 2.0
//Ethernet.init(15); // ESP8266 with Adafruit Featherwing Ethernet
//Ethernet.init(33); // ESP32 with Adafruit Featherwing Ethernet
//Ethernet.init(34); // ESP32_S2 with W5500 Ethernet
#ifndef USE_THIS_SS_PIN
#define USE_THIS_SS_PIN SS //7 //5 //10 //22 // For ESP32
#endif
ET_LOGWARN1(F("ESP32 setCsPin:"), USE_THIS_SS_PIN);
// For other boards, to change if necessary
#if ( USE_ETHERNET_GENERIC || USE_ETHERNET_ENC )
// Must use library patch for Ethernet, EthernetLarge libraries
// ESP32 => GPIO2,4,5,13,15,21,22 OK with Ethernet, Ethernet2, EthernetLarge
// ESP32 => GPIO2,4,5,15,21,22 OK with Ethernet3
//Ethernet.setCsPin (USE_THIS_SS_PIN);
Ethernet.init (USE_THIS_SS_PIN);
#elif USE_CUSTOM_ETHERNET
// You have to add initialization for your Custom Ethernet here
// This is just an example to setCSPin to USE_THIS_SS_PIN, and can be not correct and enough
Ethernet.init(USE_THIS_SS_PIN);
#endif //( USE_ETHERNET_GENERIC || USE_ETHERNET_ENC )
#elif ETHERNET_USE_RPIPICO
pinMode(USE_THIS_SS_PIN, OUTPUT);
digitalWrite(USE_THIS_SS_PIN, HIGH);
// ETHERNET_USE_RPIPICO, use default SS = 5 or 17
#ifndef USE_THIS_SS_PIN
#if defined(ARDUINO_ARCH_MBED)
#define USE_THIS_SS_PIN 5 // For Arduino Mbed core
#else
#define USE_THIS_SS_PIN 17 // For E.Philhower core
#endif
#endif
ET_LOGWARN1(F("RPIPICO setCsPin:"), USE_THIS_SS_PIN);
// For other boards, to change if necessary
#if ( USE_ETHERNET_GENERIC || USE_ETHERNET_ENC )
// Must use library patch for Ethernet, EthernetLarge libraries
// For RPI Pico using Arduino Mbed RP2040 core
// SCK: GPIO2, MOSI: GPIO3, MISO: GPIO4, SS/CS: GPIO5
// For RPI Pico using E. Philhower RP2040 core
// SCK: GPIO18, MOSI: GPIO19, MISO: GPIO16, SS/CS: GPIO17
// Default pin 5/17 to SS/CS
//Ethernet.setCsPin (USE_THIS_SS_PIN);
Ethernet.init (USE_THIS_SS_PIN);
#endif //( USE_ETHERNET_GENERIC || USE_ETHERNET_ENC )
#else //defined(ESP8266)
// unknown board, do nothing, use default SS = 10
#ifndef USE_THIS_SS_PIN
#define USE_THIS_SS_PIN 10 // For other boards
#endif
#if defined(BOARD_NAME)
ET_LOGWARN3(F("Board :"), BOARD_NAME, F(", setCsPin:"), USE_THIS_SS_PIN);
#else
ET_LOGWARN1(F("Unknown board setCsPin:"), USE_THIS_SS_PIN);
#endif
// For other boards, to change if necessary
#if ( USE_ETHERNET_GENERIC || USE_ETHERNET_ENC || USE_NATIVE_ETHERNET )
// Must use library patch for Ethernet, Ethernet2, EthernetLarge libraries
Ethernet.init (USE_THIS_SS_PIN);
#elif USE_CUSTOM_ETHERNET
// You have to add initialization for your Custom Ethernet here
// This is just an example to setCSPin to USE_THIS_SS_PIN, and can be not correct and enough
Ethernet.init(USE_THIS_SS_PIN);
#endif //( USE_ETHERNET_GENERIC || USE_ETHERNET_ENC )
#endif // defined(ESP8266)
#endif // #if !(USE_NATIVE_ETHERNET)
// start the ethernet connection and the server:
// Use DHCP dynamic IP and random mac
uint16_t index = millis() % NUMBER_OF_MAC;
// Use Static IP
//Ethernet.begin(mac[0], ip);
Ethernet.begin(mac[index]);
#if !(USE_NATIVE_ETHERNET || USE_ETHERNET_PORTENTA_H7)
ET_LOGWARN(F("========================="));
#if ( defined( ESP32 ) && USE_ETHERNET_GENERIC )
// Just info to know how to connect correctly
// To change for other SPI
ET_LOGWARN(F("Currently Used SPI pinout:"));
ET_LOGWARN1(F("MOSI:"), PIN_MOSI);
ET_LOGWARN1(F("MISO:"), PIN_MISO);
ET_LOGWARN1(F("SCK:"), PIN_SCK);
ET_LOGWARN1(F("SS:"), PIN_SS);
#else
#if defined(CUR_PIN_MISO)
ET_LOGWARN(F("Currently Used SPI pinout:"));
ET_LOGWARN1(F("MOSI:"), CUR_PIN_MOSI);
ET_LOGWARN1(F("MISO:"), CUR_PIN_MISO);
ET_LOGWARN1(F("SCK:"), CUR_PIN_SCK);
ET_LOGWARN1(F("SS:"), CUR_PIN_SS);
#else
ET_LOGWARN(F("Currently Used SPI pinout:"));
ET_LOGWARN1(F("MOSI:"), MOSI);
ET_LOGWARN1(F("MISO:"), MISO);
ET_LOGWARN1(F("SCK:"), SCK);
ET_LOGWARN1(F("SS:"), SS);
#endif
#endif
ET_LOGWARN(F("========================="));
#elif (USE_ETHERNET_PORTENTA_H7)
if (Ethernet.hardwareStatus() == EthernetNoHardware)
{
SerialDebug.println("No Ethernet found. Stay here forever");
while (true)
{
delay(1); // do nothing, no point running without Ethernet hardware
}
}
if (Ethernet.linkStatus() == LinkOFF)
{
SerialDebug.println("Not connected Ethernet cable");
}
#endif
SerialDebug.print(F("Using mac index = "));
SerialDebug.println(index);
SerialDebug.print(F("Connected! IP address: "));
SerialDebug.println(Ethernet.localIP());
}
void setup()
{
SerialDebug.begin(115200);
while (!SerialDebug && millis() < 5000);
delay(1000);
SerialDebug.print("\nStarting AdvancedWebServer on ");
SerialDebug.print(BOARD_NAME);
SerialDebug.print(F(" with "));
SerialDebug.println(SHIELD_TYPE);
SerialDebug.println(ETHERNET_WEBSERVER_VERSION);
initEthernet();
server.on(F("/"), handleRoot);
server.on(F("/test.svg"), drawGraph);
server.on(F("/inline"), []()
{
server.send(200, F("text/plain"), F("This works as well"));
});
server.onNotFound(handleNotFound);
server.begin();
SerialDebug.print(F("HTTP EthernetWebServer is @ IP : "));
SerialDebug.println(Ethernet.localIP());
}
void heartBeatPrint()
{
static int num = 1;
SerialDebug.print(F("."));
if (num == 80)
{
SerialDebug.println();
num = 1;
}
else if (num++ % 10 == 0)
{
SerialDebug.print(F(" "));
}
}
void check_status()
{
static unsigned long checkstatus_timeout = 0;
#define STATUS_CHECK_INTERVAL 10000L
// Send status report every STATUS_REPORT_INTERVAL (60) seconds: we don't need to send updates frequently if there is no status change.
if ((millis() > checkstatus_timeout) || (checkstatus_timeout == 0))
{
heartBeatPrint();
checkstatus_timeout = millis() + STATUS_CHECK_INTERVAL;
}
}
void loop()
{
server.handleClient();
check_status();
}


2. File defines.h

#ifndef defines_h
#define defines_h
#if defined(__AVR_AVR128DA48__)
#define SerialDebug Serial1
#elif defined(__AVR_AVR128DB48__)
#define SerialDebug Serial3
#else
// standard Serial
#define SerialDebug Serial
#endif
#define DEBUG_ETHERNET_GENERIC_PORT SerialDebug
#define DEBUG_ETHERNET_WEBSERVER_PORT SerialDebug
// Debug Level from 0 to 4
#define _ETG_LOGLEVEL_ 1
#define _ETHERNET_WEBSERVER_LOGLEVEL_ 3
#define USING_SPI2 false //true
#if ( defined(ARDUINO_PORTENTA_H7_M7) || defined(ARDUINO_PORTENTA_H7_M4) )
#define MULTIPLY_FACTOR 4
#if defined(BOARD_NAME)
#undef BOARD_NAME
#endif
#if defined(CORE_CM7)
#if (_ETHERNET_WEBSERVER_LOGLEVEL_ > 3)
#warning Using Portenta H7 M7 core
#endif
#define BOARD_NAME "PORTENTA_H7_M7"
#else
#if (_ETHERNET_WEBSERVER_LOGLEVEL_ > 3)
#warning Using Portenta H7 M4 core
#endif
#define BOARD_NAME "PORTENTA_H7_M4"
#endif
#define ETHERNET_USE_PORTENTA_H7 true
#define USE_ETHERNET_PORTENTA_H7 true
#endif
#if ( defined(ARDUINO_SAMD_ZERO) || defined(ARDUINO_SAMD_MKR1000) || defined(ARDUINO_SAMD_MKRWIFI1010) \
|| defined(ARDUINO_SAMD_NANO_33_IOT) || defined(ARDUINO_SAMD_MKRFox1200) || defined(ARDUINO_SAMD_MKRWAN1300) || defined(ARDUINO_SAMD_MKRWAN1310) \
|| defined(ARDUINO_SAMD_MKRGSM1400) || defined(ARDUINO_SAMD_MKRNB1500) || defined(ARDUINO_SAMD_MKRVIDOR4000) || defined(__SAMD21G18A__) \
|| defined(ARDUINO_SAMD_CIRCUITPLAYGROUND_EXPRESS) || defined(__SAMD21E18A__) || defined(__SAMD51__) || defined(__SAMD51J20A__) || defined(__SAMD51J19A__) \
|| defined(__SAMD51G19A__) || defined(__SAMD51P19A__) || defined(__SAMD21G18A__) )
#define MULTIPLY_FACTOR 2
#if defined(ETHERNET_USE_SAMD)
#undef ETHERNET_USE_SAMD
#endif
#define ETHERNET_USE_SAMD true
#endif
#if (defined(NRF52840_FEATHER) || defined(NRF52832_FEATHER) || defined(NRF52_SERIES) || defined(ARDUINO_NRF52_ADAFRUIT) || \
defined(NRF52840_FEATHER_SENSE) || defined(NRF52840_ITSYBITSY) || defined(NRF52840_CIRCUITPLAY) || \
defined(NRF52840_CLUE) || defined(NRF52840_METRO) || defined(NRF52840_PCA10056) || defined(PARTICLE_XENON) || \
defined(NRF52840_LED_GLASSES) || defined(MDBT50Q_RX) || defined(NINA_B302_ublox) || defined(NINA_B112_ublox) || \
defined(ARDUINO_Seeed_XIAO_nRF52840) || defined(ARDUINO_Seeed_XIAO_nRF52840_Sense) || \
defined(ARDUINO_SEEED_XIAO_NRF52840) || defined(ARDUINO_SEEED_XIAO_NRF52840_SENSE) )
#define MULTIPLY_FACTOR 2
#if defined(ETHERNET_USE_NRF528XX)
#undef ETHERNET_USE_NRF528XX
#endif
#define ETHERNET_USE_NRF528XX true
#endif
#if ( defined(ARDUINO_SAM_DUE) || defined(__SAM3X8E__) )
#if defined(ETHERNET_USE_SAM_DUE)
#undef ETHERNET_USE_SAM_DUE
#endif
#define ETHERNET_USE_SAM_DUE true
#endif
#if ( defined(ARDUINO_ARCH_RP2040) || defined(ARDUINO_RASPBERRY_PI_PICO) || defined(ARDUINO_ADAFRUIT_FEATHER_RP2040) || defined(ARDUINO_GENERIC_RP2040) )
#define MULTIPLY_FACTOR 4
#if defined(ETHERNET_USE_RPIPICO)
#undef ETHERNET_USE_RPIPICO
#endif
#define ETHERNET_USE_RPIPICO true
#endif
#if defined(ETHERNET_USE_SAMD)
// For SAMD
// Default pin SS/CS,if no SS pin, use pin 10
#if defined(PIN_SPI_MOSI)
//#warning Using SS pin
#define USE_THIS_SS_PIN 10 //SS
#else
#define USE_THIS_SS_PIN 10
#endif
#if ( defined(ARDUINO_SAMD_ZERO) && !defined(SEEED_XIAO_M0) )
#define BOARD_TYPE "SAMD Zero"
// Default to use W5100. Must change to false for W5500, W5100S, for faster SPI clock
// Must use true for SAMD21, such as Zero, SAMD_FEATHER_M0_EXPRESS, etc.
#define USE_W5100 true
// Use this for ARDUINO_SAMD_ZERO, etc. if can't print to terminal with Serial.print
#if defined(SERIAL_PORT_USBVIRTUAL)
#define Serial SERIAL_PORT_USBVIRTUAL
#if (_ETHERNET_WEBSERVER_LOGLEVEL_ > 3)
#warning Using SAMD Zero SerialUSB
#endif
#endif
#elif defined(ARDUINO_SAMD_MKR1000)
#define BOARD_TYPE "SAMD MKR1000"
#elif defined(ARDUINO_SAMD_MKRWIFI1010)
#define BOARD_TYPE "SAMD MKRWIFI1010"
#elif defined(ARDUINO_SAMD_NANO_33_IOT)
#define BOARD_TYPE "SAMD NANO_33_IOT"
#elif defined(ARDUINO_SAMD_MKRFox1200)
#define BOARD_TYPE "SAMD MKRFox1200"
#elif ( defined(ARDUINO_SAMD_MKRWAN1300) || defined(ARDUINO_SAMD_MKRWAN1310) )
#define BOARD_TYPE "SAMD MKRWAN13X0"
#elif defined(ARDUINO_SAMD_MKRGSM1400)
#define BOARD_TYPE "SAMD MKRGSM1400"
#elif defined(ARDUINO_SAMD_MKRNB1500)
#define BOARD_TYPE "SAMD MKRNB1500"
#elif defined(ARDUINO_SAMD_MKRVIDOR4000)
#define BOARD_TYPE "SAMD MKRVIDOR4000"
#elif defined(ARDUINO_SAMD_CIRCUITPLAYGROUND_EXPRESS)
#define BOARD_TYPE "SAMD ARDUINO_SAMD_CIRCUITPLAYGROUND_EXPRESS"
#elif defined(ADAFRUIT_FEATHER_M0_EXPRESS)
#define BOARD_TYPE "SAMD21 ADAFRUIT_FEATHER_M0_EXPRESS"
#elif defined(ADAFRUIT_METRO_M0_EXPRESS)
#define BOARD_TYPE "SAMD21 ADAFRUIT_METRO_M0_EXPRESS"
#elif defined(ADAFRUIT_CIRCUITPLAYGROUND_M0)
#define BOARD_TYPE "SAMD21 ADAFRUIT_CIRCUITPLAYGROUND_M0"
#elif defined(ADAFRUIT_GEMMA_M0)
#define BOARD_TYPE "SAMD21 ADAFRUIT_GEMMA_M0"
#elif defined(ADAFRUIT_TRINKET_M0)
#define BOARD_TYPE "SAMD21 ADAFRUIT_TRINKET_M0"
#elif defined(ADAFRUIT_ITSYBITSY_M0)
#define BOARD_TYPE "SAMD21 ADAFRUIT_ITSYBITSY_M0"
#elif defined(ARDUINO_SAMD_HALLOWING_M0)
#define BOARD_TYPE "SAMD21 ARDUINO_SAMD_HALLOWING_M0"
#elif defined(ADAFRUIT_METRO_M4_EXPRESS)
#define BOARD_TYPE "SAMD51 ADAFRUIT_METRO_M4_EXPRESS"
#elif defined(ADAFRUIT_GRAND_CENTRAL_M4)
#define BOARD_TYPE "SAMD51 ADAFRUIT_GRAND_CENTRAL_M4"
#elif defined(ADAFRUIT_FEATHER_M4_EXPRESS)
#define BOARD_TYPE "SAMD51 ADAFRUIT_FEATHER_M4_EXPRESS"
#elif defined(ADAFRUIT_ITSYBITSY_M4_EXPRESS)
#define BOARD_TYPE "SAMD51 ADAFRUIT_ITSYBITSY_M4_EXPRESS"
#define USE_THIS_SS_PIN 10
#elif defined(ADAFRUIT_TRELLIS_M4_EXPRESS)
#define BOARD_TYPE "SAMD51 ADAFRUIT_TRELLIS_M4_EXPRESS"
#elif defined(ADAFRUIT_PYPORTAL)
#define BOARD_TYPE "SAMD51 ADAFRUIT_PYPORTAL"
#elif defined(ADAFRUIT_PYPORTAL_M4_TITANO)
#define BOARD_TYPE "SAMD51 ADAFRUIT_PYPORTAL_M4_TITANO"
#elif defined(ADAFRUIT_PYBADGE_M4_EXPRESS)
#define BOARD_TYPE "SAMD51 ADAFRUIT_PYBADGE_M4_EXPRESS"
#elif defined(ADAFRUIT_METRO_M4_AIRLIFT_LITE)
#define BOARD_TYPE "SAMD51 ADAFRUIT_METRO_M4_AIRLIFT_LITE"
#elif defined(ADAFRUIT_PYGAMER_M4_EXPRESS)
#define BOARD_TYPE "SAMD51 ADAFRUIT_PYGAMER_M4_EXPRESS"
#elif defined(ADAFRUIT_PYGAMER_ADVANCE_M4_EXPRESS)
#define BOARD_TYPE "SAMD51 ADAFRUIT_PYGAMER_ADVANCE_M4_EXPRESS"
#elif defined(ADAFRUIT_PYBADGE_AIRLIFT_M4)
#define BOARD_TYPE "SAMD51 ADAFRUIT_PYBADGE_AIRLIFT_M4"
#elif defined(ADAFRUIT_MONSTER_M4SK_EXPRESS)
#define BOARD_TYPE "SAMD51 ADAFRUIT_MONSTER_M4SK_EXPRESS"
#elif defined(ADAFRUIT_HALLOWING_M4_EXPRESS)
#define BOARD_TYPE "SAMD51 ADAFRUIT_HALLOWING_M4_EXPRESS"
#elif defined(SEEED_WIO_TERMINAL)
#define BOARD_TYPE "SAMD SEEED_WIO_TERMINAL"
#elif defined(SEEED_FEMTO_M0)
#define BOARD_TYPE "SAMD SEEED_FEMTO_M0"
#elif defined(SEEED_XIAO_M0)
#define BOARD_TYPE "SAMD SEEED_XIAO_M0"
#ifdef USE_THIS_SS_PIN
#undef USE_THIS_SS_PIN
#endif
#define USE_THIS_SS_PIN A1
#if (_ETHERNET_WEBSERVER_LOGLEVEL_ > 3)
#warning define SEEED_XIAO_M0 USE_THIS_SS_PIN == A1
#endif
#elif defined(Wio_Lite_MG126)
#define BOARD_TYPE "SAMD SEEED Wio_Lite_MG126"
#elif defined(WIO_GPS_BOARD)
#define BOARD_TYPE "SAMD SEEED WIO_GPS_BOARD"
#elif defined(SEEEDUINO_ZERO)
#define BOARD_TYPE "SAMD SEEEDUINO_ZERO"
#elif defined(SEEEDUINO_LORAWAN)
#define BOARD_TYPE "SAMD SEEEDUINO_LORAWAN"
#elif defined(SEEED_GROVE_UI_WIRELESS)
#define BOARD_TYPE "SAMD SEEED_GROVE_UI_WIRELESS"
#elif defined(__SAMD21E18A__)
#define BOARD_TYPE "SAMD21E18A"
#elif defined(__SAMD21G18A__)
#define BOARD_TYPE "SAMD21G18A"
#elif defined(__SAMD51G19A__)
#define BOARD_TYPE "SAMD51G19A"
#elif defined(__SAMD51J19A__)
#define BOARD_TYPE "SAMD51J19A"
#elif defined(__SAMD51J20A__)
#define BOARD_TYPE "SAMD51J20A"
#elif defined(__SAM3X8E__)
#define BOARD_TYPE "SAM3X8E"
#elif defined(__CPU_ARC__)
#define BOARD_TYPE "CPU_ARC"
#elif defined(__SAMD51__)
#define BOARD_TYPE "SAMD51"
#else
#define BOARD_TYPE "SAMD Unknown"
#endif
#elif (ETHERNET_USE_SAM_DUE)
// Default pin 10 to SS/CS
#define USE_THIS_SS_PIN 10
#define BOARD_TYPE "SAM DUE"
#elif (ETHERNET_USE_NRF528XX)
// For Adafruit nRF52
// Default pin SS/CS,if no SS pin, use pin 10
#if defined(PIN_SPI_MOSI)
#if (_ETHERNET_WEBSERVER_LOGLEVEL_ > 3)
#warning Using SS pin
#endif
#define USE_THIS_SS_PIN SS
#else
#define USE_THIS_SS_PIN 10
#endif
#if defined(ARDUINO_Seeed_XIAO_nRF52840)
#define BOARD_TYPE "Seeed_XIAO_nRF52840"
#elif defined(ARDUINO_Seeed_XIAO_nRF52840_Sense)
#define BOARD_TYPE "Seeed_XIAO_nRF52840_Sense"
#elif defined(ARDUINO_SEEED_XIAO_NRF52840)
#define BOARD_TYPE "SEEED_XIAO_NRF52840"
#elif defined(ARDUINO_SEEED_XIAO_NRF52840_SENSE)
#define BOARD_TYPE "SEEED_XIAO_NRF52840_SENSE"
#elif defined(NRF52840_FEATHER)
#define BOARD_TYPE "NRF52840_FEATHER"
#elif defined(NRF52832_FEATHER)
#define BOARD_TYPE "NRF52832_FEATHER"
#elif defined(NRF52840_FEATHER_SENSE)
#define BOARD_TYPE "NRF52840_FEATHER_SENSE"
#elif defined(NRF52840_ITSYBITSY)
#define BOARD_TYPE "NRF52840_ITSYBITSY"
#define USE_THIS_SS_PIN 10 // For other boards
#elif defined(NRF52840_CIRCUITPLAY)
#define BOARD_TYPE "NRF52840_CIRCUITPLAY"
#elif defined(NRF52840_CLUE)
#define BOARD_TYPE "NRF52840_CLUE"
#elif defined(NRF52840_METRO)
#define BOARD_TYPE "NRF52840_METRO"
#elif defined(NRF52840_PCA10056)
#define BOARD_TYPE "NRF52840_PCA10056"
#elif defined(NINA_B302_ublox)
#define BOARD_TYPE "NINA_B302_ublox"
#elif defined(NINA_B112_ublox)
#define BOARD_TYPE "NINA_B112_ublox"
#elif defined(PARTICLE_XENON)
#define BOARD_TYPE "PARTICLE_XENON"
#elif defined(ARDUINO_NRF52_ADAFRUIT)
#define BOARD_TYPE "ARDUINO_NRF52_ADAFRUIT"
#else
#define BOARD_TYPE "nRF52 Unknown"
#endif
#elif ( defined(CORE_TEENSY) )
#define MULTIPLY_FACTOR 4
// Default pin 10 to SS/CS
#define USE_THIS_SS_PIN SS //10
#if defined(__IMXRT1062__)
// For Teensy 4.1/4.0
#if defined(ARDUINO_TEENSY41)
#define BOARD_TYPE "TEENSY 4.1"
// Use true for NativeEthernet Library, false if using other Ethernet libraries
#define USE_NATIVE_ETHERNET true
#elif defined(ARDUINO_TEENSY40)
#define BOARD_TYPE "TEENSY 4.0"
#else
#define BOARD_TYPE "TEENSY 4.x"
#endif
#elif defined(__MK66FX1M0__)
#define BOARD_TYPE "Teensy 3.6"
#elif defined(__MK64FX512__)
#define BOARD_TYPE "Teensy 3.5"
#elif defined(__MKL26Z64__)
#define BOARD_TYPE "Teensy LC"
#elif defined(__MK20DX256__)
#define BOARD_TYPE "Teensy 3.2" // and Teensy 3.1 (obsolete)
#elif defined(__MK20DX128__)
#define BOARD_TYPE "Teensy 3.0"
#elif defined(__AVR_AT90USB1286__)
#error Teensy 2.0++ not supported yet
#elif defined(__AVR_ATmega32U4__)
#error Teensy 2.0 not supported yet
#else
// For Other Boards
#define BOARD_TYPE "Unknown Teensy Board"
#endif
#elif ( defined(ESP8266) )
#define MULTIPLY_FACTOR 6 //4
// For ESP8266
#if (_ETHERNET_WEBSERVER_LOGLEVEL_ > 3)
#warning Use ESP8266 architecture
#endif
#include <ESP8266mDNS.h>
#define ETHERNET_USE_ESP8266
#define BOARD_TYPE ARDUINO_BOARD
#elif ( defined(ESP32) )
#define MULTIPLY_FACTOR 4
// For ESP32
#if (_ETHERNET_WEBSERVER_LOGLEVEL_ > 3)
#warning Use ESP32 architecture
#endif
#define ETHERNET_USE_ESP32
#define BOARD_TYPE ARDUINO_BOARD
#define W5500_RST_PORT 21
#elif ETHERNET_USE_RPIPICO
#define MULTIPLY_FACTOR 6
// Default pin 17 to SS/CS
#if defined(ARDUINO_ARCH_MBED)
// For RPI Pico using newer Arduino Mbed RP2040 core
// SCK: GPIO18, MOSI: GPIO19, MISO: GPIO16, SS/CS: GPIO17
#define USE_THIS_SS_PIN PIN_SPI_SS //17
#if defined(BOARD_NAME)
#undef BOARD_NAME
#endif
#if defined(ARDUINO_RASPBERRY_PI_PICO)
#define BOARD_TYPE "MBED RASPBERRY_PI_PICO"
#elif defined(ARDUINO_ADAFRUIT_FEATHER_RP2040)
#define BOARD_TYPE "MBED ADAFRUIT_FEATHER_RP2040"
#elif defined(ARDUINO_GENERIC_RP2040)
#define BOARD_TYPE "MBED GENERIC_RP2040"
#else
#define BOARD_TYPE "MBED Unknown RP2040"
#endif
#else
// For RPI Pico using E. Philhower RP2040 core
#if (USING_SPI2)
// SCK: GPIO14, MOSI: GPIO15, MISO: GPIO12, SS/CS: GPIO13 for SPI1
#define USE_THIS_SS_PIN PIN_SPI1_SS //13
#else
// SCK: GPIO18, MOSI: GPIO19, MISO: GPIO16, SS/CS: GPIO17 for SPI0
#define USE_THIS_SS_PIN PIN_SPI0_SS //17
#endif
#endif
#define SS_PIN_DEFAULT USE_THIS_SS_PIN
// For RPI Pico
#if (_ETHERNET_WEBSERVER_LOGLEVEL_ > 3)
#warning Use RPI-Pico RP2040 architecture
#endif
#elif defined(DXCORE)
#define MULTIPLY_FACTOR 1
// Default pin 10 to SS/CS
#define USE_THIS_SS_PIN SS
#if defined(__AVR_AVR128DA48__)
#define BOARD_TYPE "Curiosity AVR_AVR128DA48"
#elif defined(__AVR_AVR128DB48__)
#define BOARD_TYPE "Curiosity AVR_AVR128DB48"
#else
#define BOARD_TYPE "Unknown AVRDv board"
#endif
#else
#define MULTIPLY_FACTOR 1
// For Mega, etc.
// Default pin SS/CS,if no SS pin, use pin 10
#define USE_THIS_SS_PIN 10
// Reduce size for Mega
#define SENDCONTENT_P_BUFFER_SZ 512
#define BOARD_TYPE "AVR Mega"
#endif
#ifndef BOARD_NAME
#define BOARD_NAME BOARD_TYPE
#endif
#include <SPI.h>
// Use true for ENC28J60 and UIPEthernet library (https://github.com/UIPEthernet/UIPEthernet)
// Use false for W5x00 and Ethernetx library (https://www.arduino.cc/en/Reference/Ethernet)
//#define USE_UIP_ETHERNET true
#define USE_UIP_ETHERNET false
// Note: To rename ESP628266 Ethernet lib files to Ethernet_ESP8266.h and Ethernet_ESP8266.cpp
// In order to USE_ETHERNET_ESP8266
#if ( !defined(USE_UIP_ETHERNET) || !USE_UIP_ETHERNET )
// To override the default CS/SS pin. Don't use unless you know exactly which pin to use
// You can define here or customize for each board at same place with BOARD_TYPE
// Check @ defined(SEEED_XIAO_M0)
//#define USE_THIS_SS_PIN 22 //21 //5 //4 //2 //15
// Only one if the following to be true
#define USE_ETHERNET_GENERIC false //true
#define USE_ETHERNET_ESP8266 false
#define USE_ETHERNET_ENC true //false
#define USE_CUSTOM_ETHERNET false
////////////////////////////
#if ( USE_ETHERNET_GENERIC || USE_ETHERNET_ESP8266 || USE_ETHERNET_ENC || \
USE_NATIVE_ETHERNET || USE_ETHERNET_PORTENTA_H7 )
#ifdef USE_CUSTOM_ETHERNET
#undef USE_CUSTOM_ETHERNET
#endif
#define USE_CUSTOM_ETHERNET false
#endif
#if USE_ETHERNET_PORTENTA_H7
#include <Portenta_Ethernet.h>
#include <Ethernet.h>
#if (_ETHERNET_WEBSERVER_LOGLEVEL_ > 3)
#warning Using Portenta_Ethernet lib for Portenta_H7
#endif
#define SHIELD_TYPE "Ethernet using Portenta_Ethernet Library"
#elif USE_NATIVE_ETHERNET
#include "NativeEthernet.h"
#if (_ETHERNET_WEBSERVER_LOGLEVEL_ > 3)
#warning Using NativeEthernet lib for Teensy 4.1. Must also use Teensy Packages Patch or error
#endif
#define SHIELD_TYPE "Custom Ethernet using Teensy 4.1 NativeEthernet Library"
#elif USE_ETHERNET_GENERIC
#if (ESP32)
#include <soc/spi_pins.h>
// Optional SPI2
//#define USING_SPI2 true
#if USING_SPI2
// HSPI_IOMUX_PIN_NUM_???? deprecated from core v2.0.6+
// For ESP32 core v2.0.6+
#define PIN_MISO SPI2_IOMUX_PIN_NUM_MISO
#define PIN_MOSI SPI2_IOMUX_PIN_NUM_MOSI
#define PIN_SCK SPI2_IOMUX_PIN_NUM_CLK
#define PIN_SS SPI2_IOMUX_PIN_NUM_CS
#define SHIELD_TYPE "W5x00 using Ethernet_Generic Library on SPI2"
#else
#define PIN_MISO MISO
#define PIN_MOSI MOSI
#define PIN_SCK SCK
#define PIN_SS SS
#define SHIELD_TYPE "W5x00 using Ethernet_Generic Library on SPI"
#endif
#else
#if USING_SPI2
#define SHIELD_TYPE "W5x00 using Ethernet_Generic Library on SPI1"
#else
#define SHIELD_TYPE "W5x00 using Ethernet_Generic Library on SPI0/SPI"
#endif
#endif
#define ETHERNET_LARGE_BUFFERS
//#define _ETG_LOGLEVEL_ 1
#include "Ethernet_Generic.h"
#if (_ETHERNET_WEBSERVER_LOGLEVEL_ > 3)
#warning Using Ethernet_Generic lib
#endif
#elif USE_ETHERNET_ESP8266
#include "Ethernet_ESP8266.h"
#if (_ETHERNET_WEBSERVER_LOGLEVEL_ > 3)
#warning Using Ethernet_ESP8266 lib
#endif
#define SHIELD_TYPE "W5x00 using Ethernet_ESP8266 Library"
#elif USE_ETHERNET_ENC
#include "EthernetENC.h"
#if (_ETHERNET_WEBSERVER_LOGLEVEL_ > 3)
#warning Using EthernetENC lib
#endif
#define SHIELD_TYPE "ENC28J60 using EthernetENC Library"
#elif USE_CUSTOM_ETHERNET
//#include "Ethernet_XYZ.h"
#include "EthernetENC.h"
#if (_ETHERNET_WEBSERVER_LOGLEVEL_ > 3)
#warning Using Custom Ethernet library. You must include a library and initialize
#endif
#define SHIELD_TYPE "Custom Ethernet using Ethernet_XYZ Library"
#else
#ifdef USE_ETHERNET_GENERIC
#undef USE_ETHERNET_GENERIC
#endif
#define USE_ETHERNET_GENERIC true
#include "Ethernet_Generic.h"
#if (_ETHERNET_WEBSERVER_LOGLEVEL_ > 3)
#warning Using default Ethernet_Generic lib
#endif
#define SHIELD_TYPE "W5x00 using default Ethernet_Generic Library"
#endif
// Ethernet_Shield_W5200, EtherCard, EtherSia not supported
// Select just 1 of the following #include if uncomment #define USE_CUSTOM_ETHERNET
// Otherwise, standard Ethernet library will be used for W5x00
////////////////////////////
#elif USE_UIP_ETHERNET
#include "UIPEthernet.h"
#if (_ETHERNET_WEBSERVER_LOGLEVEL_ > 3)
#warning Using UIPEthernet library
#endif
#define SHIELD_TYPE "ENC28J60 using UIPEthernet Library"
#endif // #if !USE_UIP_ETHERNET
////////////////////////////
#if !defined(MULTIPLY_FACTOR)
#define MULTIPLY_FACTOR 1
#elif (MULTIPLY_FACTOR > 6)
// Limit to max 4, for Ethernet W5500 buffer of 8K
#undef MULTIPLY_FACTOR
#define MULTIPLY_FACTOR 6
#endif
////////////////////////////
#include <EthernetWebServer.h>
#ifndef SHIELD_TYPE
#define SHIELD_TYPE "Unknown Ethernet shield/library"
#endif
// Enter a MAC address and IP address for your controller below.
#define NUMBER_OF_MAC 20
byte mac[][NUMBER_OF_MAC] =
{
{ 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0x01 },
{ 0xDE, 0xAD, 0xBE, 0xEF, 0xBE, 0x02 },
{ 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0x03 },
{ 0xDE, 0xAD, 0xBE, 0xEF, 0xBE, 0x04 },
{ 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0x05 },
{ 0xDE, 0xAD, 0xBE, 0xEF, 0xBE, 0x06 },
{ 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0x07 },
{ 0xDE, 0xAD, 0xBE, 0xEF, 0xBE, 0x08 },
{ 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0x09 },
{ 0xDE, 0xAD, 0xBE, 0xEF, 0xBE, 0x0A },
{ 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0x0B },
{ 0xDE, 0xAD, 0xBE, 0xEF, 0xBE, 0x0C },
{ 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0x0D },
{ 0xDE, 0xAD, 0xBE, 0xEF, 0xBE, 0x0E },
{ 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0x0F },
{ 0xDE, 0xAD, 0xBE, 0xEF, 0xBE, 0x10 },
{ 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0x11 },
{ 0xDE, 0xAD, 0xBE, 0xEF, 0xBE, 0x12 },
{ 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0x13 },
{ 0xDE, 0xAD, 0xBE, 0xEF, 0xBE, 0x14 },
};
// Select the IP address according to your local network
IPAddress ip(192, 168, 2, 222);
// Google DNS Server IP
IPAddress myDns(8, 8, 8, 8);
#endif //defines_h



Debug Terminal Output Samples

1. AdvancedWebServer on NRF52840_FEATHER_EXPRESS with ENC28J60 using EthernetENC Library

The following are debug terminal output and screen shot when running example AdvancedWebServer on Adafruit NRF52840_FEATHER_EXPRESS with ENC28J60 using EthernetENC Library

Starting AdvancedWebServer on NRF52840_FEATHER with ENC28J60 using EthernetENC Library
EthernetWebServer v2.4.1
[EWS] =========================
[EWS] Default SPI pinout:
[EWS] MOSI: 25
[EWS] MISO: 24
[EWS] SCK: 26
[EWS] SS: 5
[EWS] =========================
[EWS] Board : NRF52840_FEATHER , setCsPin: 10
=========================
Currently Used SPI pinout:
MOSI:25
MISO:24
SCK:26
SS:5
=========================
Using mac index = 11
Connected! IP address: 192.168.2.96
HTTP EthernetWebServer is @ IP : 192.168.2.96
EthernetWebServer::handleClient: New Client
method:  GET
url:  /
search:
headerName: Host
headerValue: 192.168.2.113
headerName: Connection
headerValue: keep-alive
headerName: DNT
headerValue: 1
headerName: Upgrade-Insecure-Requests
headerValue: 1
headerName: User-Agent
headerValue: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/84.0.4147.89 Safari/537.36
headerName: Accept
headerValue: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9
headerName: Accept-Encoding
headerValue: gzip, deflate
headerName: Accept-Language
headerValue: en-GB,en-US;q=0.9,en;q=0.8
args:
args count:  0
args:
args count:  0
Request: /
Arguments: 
Final list of key/value pairs:
EthernetWebServer::_handleRequest handle
EthernetWebServer::send1: len =  347
content =  <html><head><meta http-equiv='refresh' content='5'/><title>NRF52840_FEATHER</title><style>body { background-color: #cccccc; font-family: Arial, Helvetica, Sans-Serif; Color: #000088; }</style></head><body><h2>Hello from NRF52840_FEATHER</h2><h3>running EthernetWebServer</h3><p>Uptime: 0 d 00:00:11</p><img src="/test.svg" /></body></html>
EthernetWebServer::_prepareHeader sendHeader Conn close
EthernetWebServer::send1: write header =  HTTP/1.1 200 OK
Content-Type: text/html
Content-Length: 347
Connection: close


EthernetWebServer::sendContent: Client.write content:  <html><head><meta http-equiv='refresh' content='5'/><title>AdvancedWebServer NRF52840_FEATHER</title><style>body { background-color: #cccccc; font-family: Arial, Helvetica, Sans-Serif; Color: #000088; }</style></head><body><h2>Hi from EthernetWebServer!</h2><h3>on NRF52840_FEATHER</h3><p>Uptime: 0 d 00:00:11</p><img src="/test.svg" /></body></html>
EthernetWebServer::_handleRequest OK
EthernetWebServer::handleClient: Client disconnected
EthernetWebServer::handleClient: Don't keepCurrentClient
EthernetWebServer::handleClient: Client disconnected
EthernetWebServer::handleClient: New Client
method:  GET
url:  /test.svg
search:
headerName: Host
headerValue: 192.168.2.113
headerName: Connection
headerValue: keep-alive
headerName: User-Agent
headerValue: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/84.0.4147.89 Safari/537.36
headerName: DNT
headerValue: 1
headerName: Accept
headerValue: image/webp,image/apng,image/*,*/*;q=0.8
headerName: Referer
headerValue: http://192.168.2.113/
headerName: Accept-Encoding
headerValue: gzip, deflate
headerName: Accept-Language
headerValue: en-GB,en-US;q=0.9,en;q=0.8
args:
args count:  0
args:
args count:  0
Request: /test.svg
Arguments: 
Final list of key/value pairs:
EthernetWebServer::_handleRequest handle
EthernetWebServer::send1: len =  1950
content =  <svg xmlns="http://www.w3.org/2000/svg" version="1.1" width="310" height="150">
<rect width="310" height="150" fill="rgb(250, 230, 210)" stroke-width="3" stroke="rgb(0, 0, 0)" />
<g stroke="blue">
<line x1="10" y1="98" x2="20" y2="111" stroke-width="2" />
<line x1="20" y1="111" x2="30" y2="90" stroke-width="2" />
<line x1="30" y1="90" x2="40" y2="22" stroke-width="2" />
<line x1="40" y1="22" x2="50" y2="98" stroke-width="2" />
<line x1="50" y1="98" x2="60" y2="64" stroke-width="2" />
<line x1="60" y1="64" x2="70" y2="104" stroke-width="2" />
<line x1="70" y1="104" x2="80" y2="31" stroke-width="2" />
<line x1="80" y1="31" x2="90" y2="59" stroke-width="2" />
<line x1="90" y1="59" x2="100" y2="139" stroke-width="2" />
<line x1="100" y1="139" x2="110" y2="117" stroke-width="2" />
<line x1="110" y1="117" x2="120" y2="75" stroke-width="2" />
<line x1="120" y1="75" x2="130" y2="72" stroke-width="2" />
<line x1="130" y1="72" x2="140" y2="137" stroke-width="2" />
<line x1="140" y1="137" x2="150" y2="20" stroke-width="2" />
<line x1="150" y1="20" x2="160" y2="94" stroke-width="2" />
<line x1="160" y1="94" x2="170" y2="81" stroke-width="2" />
<line x1="170" y1="81" x2="180" y2="38" stroke-width="2" />
<line x1="180" y1="38" x2="190" y2="33" stroke-width="2" />
<line x1="190" y1="33" x2="200" y2="53" stroke-width="2" />
<line x1="200" y1="53" x2="210" y2="88" stroke-width="2" />
<line x1="210" y1="88" x2="220" y2="32" stroke-width="2" />
<line x1="220" y1="32" x2="230" y2="110" stroke-width="2" />
<line x1="230" y1="110" x2="240" y2="87" stroke-width="2" />
<line x1="240" y1="87" x2="250" y2="11" stroke-width="2" />
<line x1="250" y1="11" x2="260" y2="98" stroke-width="2" />
<line x1="260" y1="98" x2="270" y2="76" stroke-width="2" />
<line x1="270" y1="76" x2="280" y2="121" stroke-width="2" />
<line x1="280" y1="121" x2="290" y2="139" stroke-width="2" />
<line x1="290" y1="139" x2="300" y2="103" stroke-width="2" />
</g>
</svg>

EthernetWebServer::_prepareHeader sendHeader Conn close
EthernetWebServer::send1: write header =  HTTP/1.1 200 OK
Content-Type: image/svg+xml
Content-Length: 1950
Connection: close

2. ENC28J60_WM_Config on ESP32 with ENC28J60 using UIPEthernet Library

The terminal output of ESP32 running a ENC28J60_WM_Config example of BlynkEthernet_WM Library

Start ENC28J60_WM_Config on ESP32
[38] EEPROMsz:1024
[38] CCSum=0x29f2,RCSum=0x29f2
[38] CrCCsum=0,CrRCsum=0
[38] Hdr=ENC28J60,BName=ESP32-ENC28J60-WM
[38] Svr=account.duckdns.org,Tok=token
[45] Svr1=account.ddns.net,Tok1=token1
[51] Prt=8080,SIP=blank
[53] MAC:FE-80-D6-B4-FC-EE
ENC28J60_CONTROL_CS =13
SS =5
SPI_MOSI =23
SPI_MISO =19
SPI_SCK =18
[5332] IP:192.168.2.103
[5332] bg:ECon.TryB
[5332] 
    ___  __          __
   / _ )/ /_ _____  / /__
  / _  / / // / _ \/  '_/
 /____/_/\_, /_//_/_/\_\
        /___/ v0.6.1 on ESP32

[5343] BlynkArduinoClient.connect: Connecting to account.duckdns.org:8080
[6454] Ready (ping: 37ms).
[6522] Connected to Blynk Server = account.duckdns.org, Token = token
[6522] bg:EBCon
Conn2Blynk: server = account.duckdns.org, port = 8080
Token = token, IP = 192.168.2.103
BBBBBBBBBB BBBBBBBBBB BBBBBBBBBB

3. SimpleWebSocket on SAM DUE with W5x00 using Ethernet_Generic Library

The terminal output of SAM DUE with W5x00 using Ethernet_Generic Library running SimpleWebSocket example to demonstrate newly-added WebSocket Client feature.

Starting SimpleWebSocket on SAM DUE with W5x00 using Ethernet_Generic Library
EthernetWebServer v2.4.1
[EWS] =========== USE_ETHERNET_GENERIC ===========
[EWS] Default SPI pinout:
[EWS] MOSI: 75
[EWS] MISO: 74
[EWS] SCK: 76
[EWS] SS: 10
[EWS] =========================
[EWS] Board : SAM DUE , setCsPin: 10
_pinCS = 0
W5100 init, using SS_PIN_DEFAULT = 10, new ss_pin = 10, W5100Class::ss_pin = 10
W5100::init: W5100, SSIZE =4096
=========================
Currently Used SPI pinout:
MOSI:75
MISO:74
SCK:76
SS:10
=========================
Using mac index = 5
Connected! IP address: 192.168.2.81
starting WebSocket client
Connection failed
disconnected
starting WebSocket client
Connected
Sending Hello 0
Sending Hello 1
Received a message:
0 => Hello from SimpleWebSocket on SAM DUE, millis = 6906
Sending Hello 2
Received a message:
1 => Hello from SimpleWebSocket on SAM DUE, millis = 11907
Sending Hello 3
Received a message:
2 => Hello from SimpleWebSocket on SAM DUE, millis = 16909
Sending Hello 4
Received a message:
3 => Hello from SimpleWebSocket on SAM DUE, millis = 21911
Sending Hello 5
Received a message:
4 => Hello from SimpleWebSocket on SAM DUE, millis = 26913
Sending Hello 6
Received a message:
5 => Hello from SimpleWebSocket on SAM DUE, millis = 31915
Sending Hello 7
Received a message:
6 => Hello from SimpleWebSocket on SAM DUE, millis = 36917
Sending Hello 8
Received a message:
7 => Hello from SimpleWebSocket on SAM DUE, millis = 41919
Sending Hello 9
Received a message:
8 => Hello from SimpleWebSocket on SAM DUE, millis = 46921
Sending Hello 10
Received a message:
9 => Hello from SimpleWebSocket on SAM DUE, millis = 51923
Sending Hello 11
Received a message:
10 => Hello from SimpleWebSocket on SAM DUE, millis = 56925
Sending Hello 12
Received a message:
11 => Hello from SimpleWebSocket on SAM DUE, millis = 61927
Sending Hello 13
Received a message:
12 => Hello from SimpleWebSocket on SAM DUE, millis = 66929
Sending Hello 14
Received a message:
13 => Hello from SimpleWebSocket on SAM DUE, millis = 71931
Sending Hello 15
Received a message:
14 => Hello from SimpleWebSocket on SAM DUE, millis = 76933
Sending Hello 16
Received a message:
15 => Hello from SimpleWebSocket on SAM DUE, millis = 81935
Sending Hello 17
Received a message:
16 => Hello from SimpleWebSocket on SAM DUE, millis = 86937
Sending Hello 18
Received a message:
17 => Hello from SimpleWebSocket on SAM DUE, millis = 91939

4. DweetPost on NRF52840_FEATHER with W5x00 using Ethernet_Generic Library

The terminal output of NRF52840_FEATHER with W5x00 using Ethernet_Generic Library running DweetPost example to demonstrate newly-added high-level HTTP Client feature.

Starting DweetPost on NRF52840_FEATHER with W5x00 using Ethernet_Generic Library
EthernetWebServer v2.4.1
[EWS] =========== USE_ETHERNET_GENERIC ===========
[EWS] Default SPI pinout:
[EWS] MOSI: 25
[EWS] MISO: 24
[EWS] SCK: 26
[EWS] SS: 5
[EWS] =========================
[EWS] Board : NRF52840_FEATHER , setCsPin: 10
=========================
Currently Used SPI pinout:
MOSI:25
MISO:24
SCK:26
SS:5
SPI_CS:10
=========================
Using mac index = 17
Connected! IP address: 192.168.2.80
making POST request
Status code: 200
Response: {"this":"succeeded","by":"dweeting","the":"dweet","with":{"thing":"scandalous-cheese-hoarder","created":"2020-11-17T05:10:59.175Z","content":{"sensorValue":40},"transaction":"08ae7c04-f1e5-4411-ad05-eb4afe77a6b4"}}
Wait ten seconds

5. ESP32_FS_EthernetWebServer on ESP32 using LittleFS with W5x00 using Ethernet_Generic Library

The terminal output of ESP32 with W5x00 using Ethernet_Generic Library running ESP32_FS_EthernetWebServer example to demonstrate newly-added WebServer serving from LittleFS/SPIFFS

Starting ESP32_FS_EthernetWebServer on ESP32 using LittleFS
With W5x00 using Ethernet_Generic Library on SPI
EthernetWebServer v2.4.1
[EWS] =========== USE_ETHERNET_GENERIC ===========
[EWS] Default SPI pinout:
[EWS] MOSI: 23
[EWS] MISO: 19
[EWS] SCK: 18
[EWS] SS: 5
[EWS] =========================
[EWS] ESP32 setCsPin: 5
=========================
Currently Used SPI pinout:
MOSI:23
MISO:19
SCK:18
SS:5
=========================
Connected! IP address: 192.168.2.139
FS File: /CanadaFlag_1.png, size: 40.25KB
FS File: /CanadaFlag_2.png, size: 8.12KB
FS File: /CanadaFlag_3.jpg, size: 10.89KB
FS File: /edit.htm.gz, size: 4.02KB
FS File: /favicon.ico, size: 1.12KB
FS File: /graphs.js.gz, size: 1.92KB
FS File: /index.htm, size: 3.63KB

HTTP server started @192.168.2.139
Open http://192.168.2.139/edit to see the file browser
handleFileRead: /edit.htm
handleFileRead: /index.htm
handleFileRead: /favicon.ico

and the screen shot of the WebServer


6. FS_EthernetWebServer on ESP8266 using LittleFS with W5x00 using Ethernet_Generic Library

The terminal output of ESP8266 with W5x00 using Ethernet_Generic Library running FS_EthernetWebServer example to demonstrate newly-added WebServer serving from LittleFS/SPIFFS

Starting FS_EthernetWebServer on ESP8266 using LittleFS
With W5x00 using Ethernet_Generic Library
EthernetWebServer v2.4.1
[EWS] =========== USE_ETHERNET_GENERIC ===========
[EWS] Default SPI pinout:
[EWS] MOSI: 13
[EWS] MISO: 12
[EWS] SCK: 14
[EWS] SS: 15
[EWS] =========================
[EWS] ESP8266 setCsPin: 4
=========================
Currently Used SPI pinout:
MOSI:13
MISO:12
SCK:14
SS:15
=========================
Connected! IP address: 192.168.2.139
Opening / directory
FS File: CanadaFlag_1.png, size: 40.25KB
FS File: CanadaFlag_2.png, size: 8.12KB
FS File: CanadaFlag_3.jpg, size: 10.89KB
FS File: edit.htm.gz, size: 4.02KB
FS File: favicon.ico, size: 1.12KB
FS File: graphs.js.gz, size: 1.92KB
FS File: index.htm, size: 3.63KB
FS File: page1.html, size: 1.16KB
FS File: page1.htm, size: 1.16KB
FS File: page2.html, size: 1.16KB
FS File: page3.html, size: 1.16KB


HTTP server started @192.168.2.139
Open http://192.168.2.139/edit to see the file browser
handleFileRead: /edit.htm
handleFileRead: /index.htm
handleFileRead: /favicon.ico

and the screen shot of the WebServer


7. serveStatic on ESP8266 using LittleFS with W5x00 using Ethernet_Generic Library

The terminal output of ESP8266 with W5x00 using Ethernet_Generic Library running serveStatic example to demonstrate newly-added WebServer serving from LittleFS/SPIFFS

Starting serveStatic demoing 'serveStatic' function on ESP8266 using LittleFS
With W5x00 using Ethernet_Generic Library
EthernetWebServer v2.4.1
[EWS] =========== USE_ETHERNET_GENERIC ===========
[EWS] Default SPI pinout:
[EWS] MOSI: 13
[EWS] MISO: 12
[EWS] SCK: 14
[EWS] SS: 15
[EWS] =========================
[EWS] ESP8266 setCsPin: 4
=========================
Currently Used SPI pinout:
MOSI:13
MISO:12
SCK:14
SS:15
=========================
Connected! IP address: 192.168.2.133
HTTP server started

and the screen shot of the WebServer


8. SimpleWebServer_NativeEthernet on Teensy 4.1 with NativeEthernet library

The following are debug terminal output and screen shot when running example SimpleWebServer_NativeEthernet on Teensy 4.1 with NativeEthernet library

SimpleWebServer_NativeEthernet on Teensy 4.1 with NativeEthernet
EthernetWebServer v2.4.1
Debug Level = 3
Connected! IP address: 192.168.2.127
[EWS] <html><head><meta http-equiv='refresh' content='5'/><title>AdvancedWebServer Teensy 4.1 with NativeEthernet</title><style>body { background-color: #cccccc; font-family: Arial, Helvetica, Sans-Serif; Color: #000088; }</style></head><body><h2>Hi from EthernetWebServer!</h2><h3>on Teensy 4.1 with NativeEthernet</h3><p>Uptime: 0 d 00:00:05</p></body></html>
========================================
[EWS] <svg xmlns="http://www.w3.org/2000/svg" version="1.1" width="310" height="150">
<rect width="310" height="150" fill="rgb(250, 230, 210)" stroke-width="1" stroke="rgb(0, 0, 0)" />
<g stroke="black">
<line x1="10" y1="77" x2="20" y2="67" stroke-width="1" />
<line x1="20" y1="67" x2="30" y2="98" stroke-width="1" />
<line x1="30" y1="98" x2="40" y2="111" stroke-width="1" />
<line x1="40" y1="111" x2="50" y2="90" stroke-width="1" />
<line x1="50" y1="90" x2="60" y2="22" stroke-width="1" />
<line x1="60" y1="22" x2="70" y2="98" stroke-width="1" />
<line x1="70" y1="98" x2="80" y2="64" stroke-width="1" />
<line x1="80" y1="64" x2="90" y2="104" stroke-width="1" />
<line x1="90" y1="104" x2="100" y2="31" stroke-width="1" />
<line x1="100" y1="31" x2="110" y2="59" stroke-width="1" />
<line x1="110" y1="59" x2="120" y2="139" stroke-width="1" />
<line x1="120" y1="139" x2="130" y2="117" stroke-width="1" />
<line x1="130" y1="117" x2="140" y2="75" stroke-width="1" />
<line x1="140" y1="75" x2="150" y2="72" stroke-width="1" />
<line x1="150" y1="72" x2="160" y2="137" stroke-width="1" />
<line x1="160" y1="137" x2="170" y2="20" stroke-width="1" />
<line x1="170" y1="20" x2="180" y2="94" stroke-width="1" />
<line x1="180" y1="94" x2="190" y2="81" stroke-width="1" />
<line x1="190" y1="81" x2="200" y2="38" stroke-width="1" />
<line x1="200" y1="38" x2="210" y2="33" stroke-width="1" />
<line x1="210" y1="33" x2="220" y2="53" stroke-width="1" />
<line x1="220" y1="53" x2="230" y2="88" stroke-width="1" />
<line x1="230" y1="88" x2="240" y2="32" stroke-width="1" />
<line x1="240" y1="32" x2="250" y2="110" stroke-width="1" />
<line x1="250" y1="110" x2="260" y2="87" stroke-width="1" />
<line x1="260" y1="87" x2="270" y2="11" stroke-width="1" />
<line x1="270" y1="11" x2="280" y2="98" stroke-width="1" />
<line x1="280" y1="98" x2="290" y2="76" stroke-width="1" />
<line x1="290" y1="76" x2="300" y2="121" stroke-width="1" />
</g>
</svg>

========================================

9. AdvancedWebServer on MBED RASPBERRY_PI_PICO with W5x00 using Ethernet_Generic Library

The following are debug terminal output and screen shot when running example AdvancedWebServer on RASPBERRY_PI_PICO with W5x00 using Ethernet_Generic Library and Arduino-mbed RP2040 core

Starting AdvancedWebServer on MBED RASPBERRY_PI_PICO with W5x00 using Ethernet_Generic Library
EthernetWebServer v2.4.1
[EWS] =========== USE_ETHERNET_GENERIC ===========
[EWS] Default SPI pinout:
[EWS] MOSI: 19
[EWS] MISO: 16
[EWS] SCK: 18
[EWS] SS: 17
[EWS] =========================
[EWS] RPIPICO setCsPin: 17
=========================
Currently Used SPI pinout:
MOSI:19
MISO:16
SCK:18
SS:17
=========================
Using mac index = 19
Connected! IP address: 192.168.2.95
HTTP EthernetWebServer is @ IP : 192.168.2.95
.[EWS] String Len = 0, extend to 2048
..

10. MQTTClient_Auth on MBED RASPBERRY_PI_PICO with W5x00 using Ethernet_Generic Library

The following are debug terminal output when running example MQTTClient_Auth on RASPBERRY_PI_PICO with W5x00 using Ethernet_Generic Library and Arduino-mbed RP2040 core

Start MQTTClient_Auth on MBED RASPBERRY_PI_PICO with W5x00 using Ethernet_Generic Library
EthernetWebServer v2.4.1
[EWS] =========== USE_ETHERNET_GENERIC ===========
[EWS] Default SPI pinout:
[EWS] MOSI: 19
[EWS] MISO: 16
[EWS] SCK: 18
[EWS] SS: 17
[EWS] =========================
[EWS] RPIPICO setCsPin: 17
=========================
Currently Used SPI pinout:
MOSI:19
MISO:16
SCK:18
SS:17
=========================
Using mac index = 10
Connected! IP address: 192.168.2.94
Attempting MQTT connection to broker.emqx.io...connected
Message Send : MQTT_Pub => Hello from MQTTClient_Auth on MBED RASPBERRY_PI_PICO with W5x00 using Ethernet_Generic Library
Message arrived [MQTT_Pub] Hello from MQTTClient_Auth on MBED RASPBERRY_PI_PICO with W5x00 using Ethernet_Generic Library

11. AdvancedWebServer on RASPBERRY_PI_PICO with W5x00 using Ethernet_Generic Library

The following are debug terminal output and screen shot when running example AdvancedWebServer on RASPBERRY_PI_PICO with W5x00 using Ethernet_Generic Library and Earle Philhower's arduino-pico core

Starting AdvancedWebServer on RASPBERRY_PI_PICO with W5x00 using Ethernet_Generic Library
EthernetWebServer v2.4.1
[EWS] =========== USE_ETHERNET_GENERIC ===========
[EWS] Default SPI pinout:
[EWS] MOSI: 19
[EWS] MISO: 16
[EWS] SCK: 18
[EWS] SS: 17
[EWS] =========================
[EWS] RPIPICO setCsPin: 17
=========================
Currently Used SPI pinout:
MOSI:19
MISO:16
SCK:18
SS:17
=========================
Using mac index = 7
Connected! IP address: 192.168.2.117
HTTP EthernetWebServer is @ IP : 192.168.2.117
.......... .......... .......... .......... .......... ..

12. UdpNTPClient on RASPBERRY_PI_PICO with W5x00 using Ethernet_Generic Library

The following are debug terminal output and screen shot when running example UdpNTPClient on RASPBERRY_PI_PICO with W5x00 using Ethernet_Generic Library and Earle Philhower's arduino-pico core

Start UdpNTPClient on RASPBERRY_PI_PICO with W5x00 using Ethernet_Generic Library
EthernetWebServer v2.4.1
[EWS] =========== USE_ETHERNET_GENERIC ===========
[EWS] Default SPI pinout:
[EWS] MOSI: 19
[EWS] MISO: 16
[EWS] SCK: 18
[EWS] SS: 17
[EWS] =========================
[EWS] RPIPICO setCsPin: 17
=========================
Currently Used SPI pinout:
MOSI:19
MISO:16
SCK:18
SS:17
=========================
Using mac index = 18
You're connected to the network, IP = 192.168.2.106
UDP Packet received, size 48
From 128.138.140.44, port 123
Seconds since Jan 1 1900 = 3830118654
Unix time = 1621129854
The UTC time is 1:50:54
UDP Packet received, size 48
From 128.138.140.44, port 123
Seconds since Jan 1 1900 = 3830118666
Unix time = 1621129866
The UTC time is 1:51:06

13. AdvancedWebServer on Teensy 4.1 using NativeEthernet Library

The following are debug terminal output and screen shot when running example AdvancedWebServer on Teensy 4.1 using NativeEthernet Library

Starting AdvancedWebServer on TEENSY 4.1 using QNEthernet
EthernetWebServer v2.4.1
[EWS] =========== USE_QN_ETHERNET ===========
Initialize Ethernet using static IP => IP Address = 192.168.2.222
HTTP EthernetWebServer is @ IP : 192.168.2.222
.[EWS] String Len = 0, extend to 2048
..........

14. AdvancedWebServer on Teensy 4.1 using QNEthernet Library

The following are debug terminal output and screen shot when running example AdvancedWebServer on Teensy 4.1 using QNEthernet Library

Starting AdvancedWebServer on TEENSY 4.1 using QNEthernet
EthernetWebServer v2.4.1
[EWS] =========== USE_QN_ETHERNET ===========
Initialize Ethernet using static IP => IP Address = 192.168.2.222
HTTP EthernetWebServer is @ IP : 192.168.2.222
.[EWS] String Len = 0, extend to 2048
......... .......... .......... .......... .......... .......... .......... ..........
.......... .......... ......

15. MQTTClient_Auth on TEENSY 4.1 using QNEthernet Library

The following is the debug terminal output when running example MQTTClient_Auth on Teensy 4.1 using QNEthernet Library

Start MQTTClient_Auth on TEENSY 4.1 using QNEthernet
EthernetWebServer v2.4.1
[EWS] =========== USE_QN_ETHERNET ===========
Initialize Ethernet using static IP => IP Address = 192.168.2.222
Attempting MQTT connection to broker.emqx.io...connected
Message Send : MQTT_Pub => Hello from MQTTClient_Auth on TEENSY 4.1 using QNEthernet
Message arrived [MQTT_Pub] Hello from MQTTClient_Auth on TEENSY 4.1 using QNEthernet
Message Send : MQTT_Pub => Hello from MQTTClient_Auth on TEENSY 4.1 using QNEthernet
Message arrived [MQTT_Pub] Hello from MQTTClient_Auth on TEENSY 4.1 using QNEthernet

16. AdvancedWebServer on PORTENTA_H7_M7 with Ethernet using Portenta_Ethernet Library

The following are debug terminal output and screen shot when running example AdvancedWebServer on PORTENTA_H7_M7 with Ethernet using Portenta_Ethernet Library

Starting AdvancedWebServer on PORTENTA_H7_M7 with Ethernet using Portenta_Ethernet Library
EthernetWebServer v2.4.1
[EWS] ======== USE_PORTENTA_H7_ETHERNET ========
Using mac index = 6
Connected! IP address: 192.168.2.222
HTTP EthernetWebServer is @ IP : 192.168.2.222
.[EWS] String Len = 0, extend to 2048
.......... .......... .......... .......... .......... ..

17. SimpleWebSocket on PORTENTA_H7_M7 with Ethernet using Portenta_Ethernet Library

The following is the debug terminal output when running example MQTTClient_Auth on PORTENTA_H7_M7 with Ethernet using Portenta_Ethernet Library

17.1 Client
Starting SimpleWebSocket on PORTENTA_H7_M7 with Ethernet using Portenta_Ethernet Library
EthernetWebServer v2.4.1
[EWS] ======== USE_PORTENTA_H7_ETHERNET ========
Using mac index = 4
Connected! IP address: 192.168.2.132
starting WebSocket client
Sending Hello 0
Sending Hello 1
Received a message:
0 => Hello from SimpleWebSocket on PORTENTA_H7_M7, millis = 5022
Sending Hello 2
Received a message:
1 => Hello from SimpleWebSocket on PORTENTA_H7_M7, millis = 10075
Sending Hello 3
Received a message:
2 => Hello from SimpleWebSocket on PORTENTA_H7_M7, millis = 15132
Sending Hello 4
Received a message:
3 => Hello from SimpleWebSocket on PORTENTA_H7_M7, millis = 20145
Sending Hello 5
Received a message:
4 => Hello from SimpleWebSocket on PORTENTA_H7_M7, millis = 25152
17.2 Server
kh@kh-Inspiron-3593:~/Downloads/Nodejs/simple-websocket-server$ ./WS_server.sh 
Wed Sep 08 2021 21:30:46 GMT-0400 (Eastern Daylight Time) Server is listening on port 8080
Wed Sep 08 2021 21:31:08 GMT-0400 (Eastern Daylight Time) Connection accepted.
Received Message: 0 => Hello from SimpleWebSocket on PORTENTA_H7_M7, millis = 5022
Received Message: 1 => Hello from SimpleWebSocket on PORTENTA_H7_M7, millis = 10075
Received Message: 2 => Hello from SimpleWebSocket on PORTENTA_H7_M7, millis = 15132
Received Message: 3 => Hello from SimpleWebSocket on PORTENTA_H7_M7, millis = 20145
Received Message: 4 => Hello from SimpleWebSocket on PORTENTA_H7_M7, millis = 25152
Received Message: 5 => Hello from SimpleWebSocket on PORTENTA_H7_M7, millis = 30248
Received Message: 6 => Hello from SimpleWebSocket on PORTENTA_H7_M7, millis = 35256

18. MQTTClient_Auth on PORTENTA_H7_M7 with Ethernet using Portenta_Ethernet Library

The following is the debug terminal output when running example MQTTClient_Auth on PORTENTA_H7_M7 with Ethernet using Portenta_Ethernet Library

Start MQTTClient_Auth on PORTENTA_H7_M7 with Ethernet using Portenta_Ethernet Library
EthernetWebServer v2.4.1
[EWS] ======== USE_PORTENTA_H7_ETHERNET ========
Using mac index = 7
Connected! IP address: 192.168.2.132
Attempting MQTT connection to broker.emqx.io...connected
Message Send : MQTT_Pub => Hello from MQTTClient_Auth on PORTENTA_H7_M7 with Ethernet using Portenta_Ethernet Library
Message arrived [MQTT_Pub] Hello from MQTTClient_Auth on PORTENTA_H7_M7 with Ethernet using Portenta_Ethernet Library
Message Send : MQTT_Pub => Hello from MQTTClient_Auth on PORTENTA_H7_M7 with Ethernet using Portenta_Ethernet Library
Message arrived [MQTT_Pub] Hello from MQTTClient_Auth on PORTENTA_H7_M7 with Ethernet using Portenta_Ethernet Library
Message Send : MQTT_Pub => Hello from MQTTClient_Auth on PORTENTA_H7_M7 with Ethernet using Portenta_Ethernet Library
Message arrived [MQTT_Pub] Hello from MQTTClient_Auth on PORTENTA_H7_M7 with Ethernet using Portenta_Ethernet Library
Message Send : MQTT_Pub => Hello from MQTTClient_Auth on PORTENTA_H7_M7 with Ethernet using Portenta_Ethernet Library
Message arrived [MQTT_Pub] Hello from MQTTClient_Auth on PORTENTA_H7_M7 with Ethernet using Portenta_Ethernet Library
Message Send : MQTT_Pub => Hello from MQTTClient_Auth on PORTENTA_H7_M7 with Ethernet using Portenta_Ethernet Library
Message arrived [MQTT_Pub] Hello from MQTTClient_Auth on PORTENTA_H7_M7 with Ethernet using Portenta_Ethernet Library
Message Send : MQTT_Pub => Hello from MQTTClient_Auth on PORTENTA_H7_M7 with Ethernet using Portenta_Ethernet Library
Message arrived [MQTT_Pub] Hello from MQTTClient_Auth on PORTENTA_H7_M7 with Ethernet using Portenta_Ethernet Library

19. WiFi_Ethernet_Complex_ESP32 on ESP32_DEV

The following are debug terminal output when running example WiFi_Ethernet_Complex_ESP32 on ESP32_DEV using both EthernetWebServer and WebServer Library simultaneously.

Starting WiFi_Ethernet_Complex_ESP32 on ESP32_DEV
Connecting to HueNet1
.......
WiFi connected
IP address: 
192.168.2.105
[EWS] ESP32 setCsPin: 22
_pinCS = 0
W5100 init, using SS_PIN_DEFAULT = 22, new ss_pin = 10, W5100Class::ss_pin = 22
W5100::init: W5500, SSIZE =8192
HTTP EthernetWebServer is @ IP : 192.168.2.114
HTTP WiFiWebServer is @ IP : 192.168.2.105

20. WiFi_Ethernet_Complex_ESP8266 on ESP8266_NODEMCU_ESP12E

The following are debug terminal output when running example WiFi_Ethernet_Complex_ESP8266 on ESP8266_NODEMCU_ESP12E using both EthernetWebServer and WebServer Library simultaneously.

Starting WiFi_Ethernet_Complex_ESP8266 on ESP8266_NODEMCU_ESP12E
Connecting to HueNet1
...........
WiFi connected
IP address: 
192.168.2.109
[EWS] ESP8266 setCsPin: 4
=========================
Currently Used SPI pinout:
MOSI:13
MISO:12
SCK:14
SS:15
HTTP EthernetWebServer is @ IP : 192.168.2.111
HTTP WiFiWebServer is @ IP : 192.168.2.109

21. AdvancedWebServer_ESP32_SPI2 on ESP32_DEV with W5x00 using Ethernet_Generic Library on SPI2

The following are debug terminal output and screen shot when running example AdvancedWebServer_ESP32_SPI2 on ESP32_DEV with W5500 using Ethernet_Generic Library on SPI2

Starting AdvancedWebServer_ESP32_SPI2 on ESP32_DEV with W5x00 using Ethernet_Generic Library on SPI2
EthernetWebServer v2.4.1
=========================
Currently Used SPI pinout:
MOSI:13
MISO:12
SCK:14
SS:5
=========================
Using mac index = 0
Connected! IP address: 192.168.2.102
Speed: 100 MB, Duplex: FULL DUPLEX, Link status: LINK
HTTP EthernetWebServer is @ IP : 192.168.2.102
.
[EWS] String Len = 0, extend to 2048

22. AdvancedWebServer on RASPBERRY_PI_PICO with W5x00 using Ethernet_Generic Library on SPI1

The following are debug terminal output and screen shot when running example AdvancedWebServer on RASPBERRY_PI_PICO with W5500 using Ethernet_Generic Library on SPI1 and arduino-pico core

Starting AdvancedWebServer on RASPBERRY_PI_PICO with W5x00 using Ethernet_Generic Library on SPI1
EthernetWebServer v2.4.1
[EWS] =========== USE_ETHERNET_GENERIC ===========
[EWS] Default SPI pinout:
[EWS] MOSI: 15
[EWS] MISO: 12
[EWS] SCK: 14
[EWS] SS: 13
[EWS] =========================
[EWS] RPIPICO setCsPin: 13
[EWS] =========================
[EWS] Currently Used SPI pinout:
[EWS] MOSI: 15
[EWS] MISO: 12
[EWS] SCK: 14
[EWS] SS: 13
[EWS] =========================
Using mac index = 13
Connected! IP address: 192.168.2.104
HTTP EthernetWebServer is @ IP : 192.168.2.104
.[EWS] String Len = 0, extend to 2048
......... .......... ..........

23. AdvancedWebServer_RP2040_SPI1 on MBED RASPBERRY_PI_PICO with W5x00 using Ethernet_Generic Library on SPI1

The following are debug terminal output and screen shot when running example AdvancedWebServer_RP2040_SPI1 on MBED RASPBERRY_PI_PICO with W5500 using Ethernet_Generic Library on SPI1 and ArduinoCore-mbed

Starting AdvancedWebServer_RP2040_SPI1 on MBED RASPBERRY_PI_PICO with W5x00 using Ethernet_Generic Library with Large Buffer
EthernetWebServer v2.4.1
[EWS] =========== USE_ETHERNET_GENERIC ===========
[EWS] Default SPI pinout:
[EWS] MOSI: 15
[EWS] MISO: 12
[EWS] SCK: 14
[EWS] SS: 13
[EWS] =========================
[EWS] RPIPICO setCsPin: 13
[EWS] =========================
[EWS] Currently Used SPI pinout:
[EWS] MOSI: 15
[EWS] MISO: 12
[EWS] SCK: 14
[EWS] SS: 13
[EWS] =========================
Using mac index = 6
Connected! IP address: 192.168.2.97
HTTP EthernetWebServer is @ IP : 192.168.2.97
...

24. AdvancedWebServer_Teensy4x_SPI1 on TEENSY 4.1 with W5x00 using Ethernet_Generic Library on SPI1

The following are debug terminal output and screen shot when running example AdvancedWebServer_Teensy4x_SPI1 on Teensy 4.1 with W5500 using Ethernet_Generic Library on SPI1

Starting AdvancedWebServer_Teensy4x_SPI1 on TEENSY 4.1 with W5x00 using Ethernet_Generic Library with Large Buffer
EthernetWebServer v2.4.1
[EWS] =========== USE_ETHERNET_GENERIC ===========
[EWS] Default SPI pinout:
[EWS] MOSI: 26
[EWS] MISO: 1
[EWS] SCK: 27
[EWS] SS: 0
[EWS] =========================
[EWS] Board : TEENSY 4.1 , setCsPin: 0
[EWS] =========================
[EWS] Currently Used SPI pinout:
[EWS] MOSI: 26
[EWS] MISO: 1
[EWS] SCK: 27
[EWS] SS: 0
[EWS] =========================
Using mac index = 15
Connected! IP address: 192.168.2.101
HTTP EthernetWebServer is @ IP : 192.168.2.101
.[EWS] String Len = 0, extend to 2048
......... .......... ..........

25. AdvancedWebServer on Curiosity AVR_AVR128DA48 with W5x00 using Ethernet_Generic Library on SPI

The following are debug terminal output and screen shot when running example AdvancedWebServer on Curiosity AVR_AVR128DA48 with W5500 using Ethernet_Generic Library on SPI

Starting AdvancedWebServer on Curiosity AVR_AVR128DA48 with W5x00 using Ethernet_Generic Library on SPI0/SPI
EthernetWebServer v2.4.1
[EWS] =========== USE_ETHERNET_GENERIC ===========
[EWS] Default SPI pinout:
[EWS] MOSI: 4
[EWS] MISO: 5
[EWS] SCK: 6
[EWS] SS: 7
[EWS] =========================
[EWS] Board : Curiosity AVR_AVR128DA48 , setCsPin: 7
[ETG] W5100 init, using W5100Class::ss_pin =  7 , whereas new ss_pin =  10 , SS_PIN_DEFAULT = 10
[ETG] Chip is W5500
[ETG] W5100::init: W5500, SSIZE = 8192
[EWS] =========================
[EWS] Currently Used SPI pinout:
[EWS] MOSI: 4
[EWS] MISO: 5
[EWS] SCK: 6
[EWS] SS: 7
[EWS] =========================
Using mac index = 6
Connected! IP address: 192.168.2.105
HTTP EthernetWebServer is @ IP : 192.168.2.105
..[EWS] String Len = 0, extend to 2048
........ .......... .......... .......... ...

26. EthernetWebServer_BigData on NRF52840_FEATHER

The following is debug terminal output when running example EthernetWebServer_BigData on NRF52840_FEATHER board, using W5500 Ethernet with Ethernet_Generic Library, to demo how to send much larger data than total 8K

MULTIPLY_FACTOR = 3.0f
Start EthernetWebServer_BigData on NRF52840_FEATHER with W5x00 using Ethernet_Generic Library on SPI0/SPI
EthernetWebServer v2.4.1
[ETG] W5100 init, using W5100Class::ss_pin =  5 , whereas new ss_pin =  10 , SS_PIN_DEFAULT = 10
[ETG] Chip is W5500
[ETG] W5100::init: W5500, SSIZE = 8192
Using mac index = 14
Connected! IP address: 192.168.2.135
String Len = 23712
[ETG] EthernetClient::write: To write, size =  86
[ETG] EthernetClient::write: written =  86 , totalBytesSent = 86
[ETG] EthernetClient::write: Done, written =  86 , totalBytesSent = 86
[ETG] EthernetClient::write: To write, size =  23712
[ETG] EthernetClient::write: written =  8192 , totalBytesSent = 8192
[ETG] EthernetClient::write: Partially Done, written =  8192 , bytesRemaining = 15520
[ETG] EthernetClient::write: written =  8192 , totalBytesSent = 16384
[ETG] EthernetClient::write: Partially Done, written =  8192 , bytesRemaining = 7328
[ETG] EthernetClient::write: written =  7328 , totalBytesSent = 23712
[ETG] EthernetClient::write: Done, written =  7328 , totalBytesSent = 23712
[ETG] EthernetClient::write: To write, size =  91
[ETG] EthernetClient::write: written =  91 , totalBytesSent = 91
[ETG] EthernetClient::write: Done, written =  91 , totalBytesSent = 91
[ETG] EthernetClient::write: To write, size =  59
[ETG] EthernetClient::write: written =  59 , totalBytesSent = 59
[ETG] EthernetClient::write: Done, written =  59 , totalBytesSent = 59
String Len = 23712
[ETG] EthernetClient::write: To write, size =  86
[ETG] EthernetClient::write: written =  86 , totalBytesSent = 86
[ETG] EthernetClient::write: Done, written =  86 , totalBytesSent = 86
[ETG] EthernetClient::write: To write, size =  23712
[ETG] EthernetClient::write: written =  8192 , totalBytesSent = 8192
[ETG] EthernetClient::write: Partially Done, written =  8192 , bytesRemaining = 15520
[ETG] EthernetClient::write: written =  8192 , totalBytesSent = 16384
[ETG] EthernetClient::write: Partially Done, written =  8192 , bytesRemaining = 7328
[ETG] EthernetClient::write: written =  7328 , totalBytesSent = 23712
[ETG] EthernetClient::write: Done, written =  7328 , totalBytesSent = 23712

27. EthernetWebServer_BigData on RASPBERRY_PI_PICO

The following is debug terminal output when running example EthernetWebServer_BigData on RASPBERRY_PI_PICO board, using W5500 Ethernet with Ethernet_Generic Library, to demo how to send much larger data than total 8K

MULTIPLY_FACTOR = 3.0f
Start EthernetWebServer_BigData on RASPBERRY_PI_PICO with W5x00 using Ethernet_Generic Library on SPI0/SPI
EthernetWebServer v2.4.1
[ETG] W5100 init, using W5100Class::ss_pin =  17 , whereas new ss_pin =  10 , SS_PIN_DEFAULT = 17
[ETG] Chip is W5100S
[ETG] W5100::init: W5100S, SSIZE = 4096
Using mac index = 7
Connected! IP address: 192.168.2.111
String Len = 23714
[ETG] EthernetClient::write: To write, size =  86
[ETG] EthernetClient::write: written =  86 , totalBytesSent = 86
[ETG] EthernetClient::write: Done, written =  86 , totalBytesSent = 86
[ETG] EthernetClient::write: To write, size =  23714
[ETG] EthernetClient::write: written =  4096 , totalBytesSent = 4096
[ETG] EthernetClient::write: Partially Done, written =  4096 , bytesRemaining = 19618
[ETG] EthernetClient::write: written =  4096 , totalBytesSent = 8192
[ETG] EthernetClient::write: Partially Done, written =  4096 , bytesRemaining = 15522
[ETG] EthernetClient::write: written =  4096 , totalBytesSent = 12288
[ETG] EthernetClient::write: Partially Done, written =  4096 , bytesRemaining = 11426
[ETG] EthernetClient::write: written =  4096 , totalBytesSent = 16384
[ETG] EthernetClient::write: Partially Done, written =  4096 , bytesRemaining = 7330
[ETG] EthernetClient::write: written =  4096 , totalBytesSent = 20480
[ETG] EthernetClient::write: Partially Done, written =  4096 , bytesRemaining = 3234
[ETG] EthernetClient::write: written =  3234 , totalBytesSent = 23714
[ETG] EthernetClient::write: Done, written =  3234 , totalBytesSent = 23714
String Len = 23714
[ETG] EthernetClient::write: To write, size =  86
[ETG] EthernetClient::write: written =  86 , totalBytesSent = 86
[ETG] EthernetClient::write: Done, written =  86 , totalBytesSent = 86
[ETG] EthernetClient::write: To write, size =  23714
[ETG] EthernetClient::write: written =  4096 , totalBytesSent = 4096
[ETG] EthernetClient::write: Partially Done, written =  4096 , bytesRemaining = 19618
[ETG] EthernetClient::write: written =  4096 , totalBytesSent = 8192
[ETG] EthernetClient::write: Partially Done, written =  4096 , bytesRemaining = 15522
[ETG] EthernetClient::write: written =  4096 , totalBytesSent = 12288
[ETG] EthernetClient::write: Partially Done, written =  4096 , bytesRemaining = 11426
[ETG] EthernetClient::write: written =  4096 , totalBytesSent = 16384
[ETG] EthernetClient::write: Partially Done, written =  4096 , bytesRemaining = 7330
[ETG] EthernetClient::write: written =  4096 , totalBytesSent = 20480
[ETG] EthernetClient::write: Partially Done, written =  4096 , bytesRemaining = 3234
[ETG] EthernetClient::write: written =  3234 , totalBytesSent = 23714
[ETG] EthernetClient::write: Done, written =  3234 , totalBytesSent = 23714

28. AdvancedWebServer on ESP32_DEV with W6100 using Ethernet_Generic Library on SPI

The following are debug terminal output when running example AdvancedWebServer on ESP32_DEV with WIZnet WIZ610MJ W6100 using Ethernet_Generic Library

Starting AdvancedWebServer on ESP32_DEV with W5x00 using Ethernet_Generic Library on SPI
EthernetWebServer v2.4.1
[EWS] =========== USE_ETHERNET_GENERIC ===========
[EWS] Default SPI pinout:
[EWS] MOSI: 23
[EWS] MISO: 19
[EWS] SCK: 18
[EWS] SS: 5
[EWS] =========================
[EWS] ESP32 setCsPin: 5
[ETG] W5100 init, using W5100Class::ss_pin =  5 , whereas new ss_pin =  10 , SS_PIN_DEFAULT = 22
[ETG] Chip is W6100
[EWS] =========================
[EWS] Currently Used SPI pinout:
[EWS] MOSI: 23
[EWS] MISO: 19
[EWS] SCK: 18
[EWS] SS: 5
[EWS] =========================
Using mac index = 1
Connected! IP address: 192.168.2.107
HTTP EthernetWebServer is @ IP : 192.168.2.107
..[EWS] String Len = 0, extend to 8192
[EWS] String Len =  7455
[EWS] String Len =  7450


Debug

Debug is enabled by default on Serial. Debug Level from 0 to 4. To disable, change the ETHERNET_WEBSERVER_LOGLEVEL to 0

// Use this to output debug msgs to Serial
#define DEBUG_ETHERNET_WEBSERVER_PORT       Serial
// Use this to disable all output debug msgs
// Debug Level from 0 to 4
#define _ETHERNET_WEBSERVER_LOGLEVEL_       0

Troubleshooting

If you get compilation errors, more often than not, you may need to install a newer version of the board's core, applying Libraries' Patches, Packages' Patches or this library latest version.



Issues

Submit issues to: EthernetWebServer issues


TO DO

  1. Bug Searching and Killing
  2. Add Server support
  3. Support more types of boards using Ethernet shields.
  4. Support more non-compatible Ethernet Libraries such as Ethernet_Shield_W5200, EtherCard, EtherSia
  5. Add mDNS features.

DONE

  1. Add support to Arduino SAMD21 (ZERO, MKR, NANO_33_IOT, etc.)
  2. Add support to Adafruit SAMD21 (Itsy-Bitsy M0, Metro M0, Feather M0 Express, etc.).
  3. Add support to Adafruit SAMD51 (Itsy-Bitsy M4, Metro M4, Grand Central M4, Feather M4 Express, etc.).
  4. Add support to Adafruit nRF52 ( Feather nRF52832, nRF52840 Express, BlueFruit Sense, Itsy-Bitsy nRF52840 Express, Metro nRF52840 Express, NINA_B302_ublox, NINA_B112_ublox, etc..
  5. Add support to SAM DUE.
  6. Add support to Ethernet W5x00, using either Ethernet, Ethernet2, Ethernet3 or EthernetLarge library
  7. Add support to Ethernet ENC28J60, using UIPEthernet library
  8. Add support to ESP32 and ESP8266
  9. Add support to Seeeduino SAMD21/SAMD51: LoRaWAN, Zero, Femto M0, XIAO M0, Wio GPS Board, Wio Terminal, Grove UI Wireless
  10. Add support to EthernetENC
  11. Add support to PROGMEM-related commands, such as sendContent_P() and send_P()
  12. Add High-level HTTP (GET, POST, PUT, PATCH, DELETE) and WebSocket Client
  13. Add support to RP2040-based boards such as RASPBERRY_PI_PICO, using Arduino-mbed RP2040 core
  14. Add support to RP2040-based boards such as RASPBERRY_PI_PICO, using Earle Philhower's arduino-pico core v1.3.1+
  15. Add support to Teensy 4.1 built-in Ethernet using NativeEthernet library
  16. Add support to Teensy 4.1 built-in Ethernet using QNEthernet library
  17. Add support to Portenta_H7 boards, using Arduino-mbed mbed_portenta core.
  18. Reduce usage of Arduino String with std::string
  19. Optimize library code and examples by using reference-passing instead of value-passing.
  20. Make breaking changes in v2.0.0 to permit coexistence with ESP32 WebServer and ESP8266 ESP8266WebServer libraries
  21. Add support to SAMD21/SAMD51 boards using Fab_SAM_Arduino core
  22. Fix bug when using QNEthernet staticIP.
  23. Add staticIP option to NativeEthernet examples
  24. Use new Ethernet_Generic library as default for W5x00.
  25. Support SPI2 for ESP32
  26. Add support to SPI1 for RP2040 using arduino-pico core
  27. Drop EthernetWrapper
  28. Add example multiFileProject to demo how to avoid multiple-definitions linker error for multiple-file project
  29. Change from arduino.cc to arduino.tips in examples
  30. Add support to SPI1, SPI2 for Teensy using W5x00 with Ethernet_Generic library
  31. Add support to custom SPI for Mbed RP2040, Portenta-H7, etc. using W5x00 with Ethernet_Generic library
  32. Add examples AdvancedWebServer_Teensy4x_SPI1 and AdvancedWebServer_RP2040_SPI1 to demo new features
  33. Auto-select SPI(s) SS/CS pins according to board package if available
  34. Slow SPI clock for old W5100 shield or SAMD Zero
  35. Use correct Debug Terminal Serial for so-called SAMD21 Zero boards from Arduino as well as Adafruit
  36. Add support to AVR Dx (AVR128Dx, AVR64Dx, AVR32Dx, etc.) using DxCore
  37. Add support to Seeeduino nRF52840-based boards such as SEEED_XIAO_NRF52840 and SEEED_XIAO_NRF52840_SENSE, etc. using Seeed mbed or nRF52 core
  38. Add astyle using allman style. Restyle the library
  39. Update Packages' Patches to add Seeeduino nRF52 core
  40. Add examples EthernetWebServer_BigData to demo how to send larger data than 2/4/8/16K buffer
  41. Modify example AdvancedWebServer to demo how to send larger data than 2/4/8/16K buffer
  42. Fix compile errors for new ESP32 core v2.0.6
  43. Add support to WIZNet W6100 using IPv4


Contributions and Thanks

Many thanks for everyone for bug reporting, new feature suggesting, testing and contributing to the development of this library.

  1. Based on and modified from the good Ivan Grokhotkov's ESP8266WebServer and ESP32 WebServer libraries.
  2. jandrassy for EthernetENC and UIPEthernet library
  3. Thanks to good work of Miguel Alexandre Wisintainer for initiating, inspriring, working with, developing, debugging and testing. Without that, support to nRF52, especially U-Blox B302 running as nRF52840 and U-Blox B112 running as nRF52832, has never been started and finished. Also see ESP32-based U-BLOX NINA W102 running ENC28J60.
  4. Thanks to Vladimir to initiate the work on ESP32 and ESP8266 in Spiffs not work Issue #2
  5. Adrian McEwen for HttpClient Library on which the ArduinoHttpClient Library and this EthernetWebServer library are relied.
  6. Thanks to jimmie11 to report and suggest a fix in Compile Error on Teensy 4.1 #14 leading to the new version v1.2.0 to provide support to Teensy 4.1 using NativeEthernet Library
  7. Thanks to Sardar Azari to make PR in streamFile and serveStatic for ESP8266/ESP32 boards #22 leading to the new version v1.3.0 to add WebServer feature to serve static from LittleFS/SPIFFS for ESP32/ESP8266. The example serveStatic and serveStaticLoadFile are also contributed by Sardar Azari.
  8. Thanks to neardreams to report issue Something wrong in http response header #41, then make PR in fix for wrong http status header #42 leading to the new version v1.8.2 to fix wrong http status header bug.
  9. Thanks to dirkdickler to report issue server.authenticate problem #43 which was fixed in v1.8.2
  10. Thanks to Shahram to report issues
  1. RQnet to report issue Decoding Error. two times called urlDecode in Parsing-impl.h. #17 leading to version v2.0.1 to fix the decoding error bug when using special & in data fields.
igrr
⭐️ Ivan Grokhotkov

amcewen
⭐️ Adrian McEwen

jandrassy
⭐️ Juraj Andrássy

tcpipchip
⭐️ Miguel Wisintainer

Vladimir
Vladimir

jimmie11
jimmie11

gagulik
Sardar Azari

neardreams
neardreams

dirkdickler
dirkdickler

Nourbakhsh-Rad
Shahram

RQnet
RQnet


Contributing

If you want to contribute to this project:

  • Report bugs and errors
  • Ask for enhancements
  • Create issues and pull requests
  • Tell other people about this library

License

  • The library is licensed under MIT

Copyright

Copyright (C) 2020- Khoi Hoang

ethernetwebserver's People

Contributors

khoih-prog avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

ethernetwebserver's Issues

ESP32 keeps rebooting when trying to use pointers.

Hello,

It's possible to use pointers when creating the EthernetWebServer class object, to change port number on setup?

I can compile the code using sometihng like this...

EthernetWebServer *server

void setup() {
  server = new EthernetWebServer(desiredPortNumber);
  server->begin();

But when I turn on the board, it keeps rebooting non stop.

Rebooting...
ets Jun  8 2016 00:22:57

rst:0xc (SW_CPU_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
configsip: 0, SPIWP:0xee
clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
mode:DIO, clock div:1
load:0x3fff0030,len:1184
load:0x40078000,len:12804
ho 0 tail 12 room 4
load:0x40080400,len:3032
entry 0x400805e4
Guru Meditation Error: Core  1 panic'ed (LoadProhibited). Exception was unhandled.

Core  1 register dump:
PC      : 0x400d3c1b  PS      : 0x00060f30  A0      : 0x800d3f49  A1      : 0x3ffb26c0  
A2      : 0x3ffb26fc  A3      : 0x00000060  A4      : 0x0000000b  A5      : 0x0000ff00  
A6      : 0x00ff0000  A7      : 0xff000000  A8      : 0x3ffb9410  A9      : 0x3ffb93f8  
A10     : 0x3ffb9410  A11     : 0x00001800  A12     : 0x00000000  A13     : 0x00000000  
A14     : 0x00001004  A15     : 0x3ffb0874  SAR     : 0x00000010  EXCCAUSE: 0x0000001c  
EXCVADDR: 0x00000068  LBEG    : 0x400863a9  LEND    : 0x400863cb  LCOUNT  : 0xffffffff  


Backtrace:0x400d3c18:0x3ffb26c00x400d3f46:0x3ffb26e0 0x400d3fa1:0x3ffb2730 0x400d4101:0x3ffb2770 0x400d4640:0x3ffb27c0 0x400dc4aa:0x3ffb2820 




ELF file SHA256: 0000000000000000

That's what happens when I turn on the board...

Can you give me some advice about what to do to solve this, or, any other way to change port number on another part of the code?

RP2040-W5500 UdpSendReceive

I am using RP20408(Arduino-Mbed core) and W5500. I tried UdpSendReceive but I can't work it.

Start UDPSendReceive on MBED RASPBERRY_PI_PICO with W5x00 using Ethernet_Generic Library on SPI0/SPI
EthernetWebServer v2.2.0
[EWS] =========== USE_ETHERNET_GENERIC ===========
[EWS] Default SPI pinout:
[EWS] MOSI: 19
[EWS] MISO: 16
[EWS] SCK: 18
[EWS] SS: 17
[EWS] =========================
[EWS] RPIPICO setCsPin: 5
[ETG] W5100::init: no chip :-(
[EWS] =========================
[EWS] Currently Used SPI pinout:
[EWS] MOSI: 3
[EWS] MISO: 4
[EWS] SCK: 2
[EWS] SS: 5
[EWS] =========================
Using mac index = 11
Connected! IP address: 0.0.0.0

MDNS support

Hi,
Does this library support MDNS for esp32?
Arduino for esp32 has ESPmDNS library but I cant find any example here...
Thank you

Upload file is very slow

Describe the bug

A clear and concise description of what the bug is.

Steps to Reproduce

Steps to reproduce the behavior. Including the MRE sketches

Expected behavior

A clear and concise description of what you expected to happen.

Actual behavior

A clear and concise description of what you expected to happen.

Debug and AT-command log (if applicable)

A clear and concise description of what you expected to happen.

Screenshots

If applicable, add screenshots to help explain your problem.

Information

Please ensure to specify the following:

  • Arduino IDE version (e.g. 1.8.13) or Platform.io version
  • ESP8266,ESP32 or STM32 Core Version (e.g. ESP8266 core v2.7.4, ESP32 v1.0.5 or STM32 v1.9.0)
  • Contextual information (e.g. what you were trying to achieve)
  • Simplest possible steps to reproduce
  • Anything that might be relevant in your opinion, such as:
    • Operating system (Windows, Ubuntu, etc.) and the output of uname -a
    • Network configuration

Example

Arduino IDE version: 1.8.13
ESP32 Core Version 1.0.5
OS: Ubuntu 20.04 LTS
Linux xy-Inspiron-3593 5.4.0-66-generic #74-Ubuntu SMP Wed Jan 27 22:54:38 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux

Context:
I encountered an endless loop while trying to connect to Local WiFi.

Steps to reproduce:
1. ...
2. ...
3. ...
4. ...

Additional context

Add any other context about the problem here.

Compile Error on Teensy 4.1

Thank you for your efforts. I was very happy to find a library that works on Teensy 4.1 however I am unable to compile the WebServer example. I had download the VLP library and also copied boards.txt but this did not help. I also tried changing Ethernet.h to NativeEthernet.h but his did not help either.

Here is the error:

C:\Program Files (x86)\Arduino\hardware\teensy\avr\cores\teensy4/Stream.h:68:6: error: 'int Stream::timedRead()' is private

int timedRead();

  ^

C:\Users\TTC\Documents\Arduino\libraries\EthernetWebServer-master\src\Ethernet_HTTPClient\Ethernet_HttpClient.cpp:642:13: error: within this context

 int c = timedRead();

         ^

In file included from C:\Program Files (x86)\Arduino\hardware\teensy\avr\cores\teensy4/HardwareSerial.h:106:0,

             from C:\Program Files (x86)\Arduino\hardware\teensy\avr\cores\teensy4/WProgram.h:46,

             from C:\Users\TTC\AppData\Local\Temp\arduino_build_394779/pch/Arduino.h:6,

             from C:\Users\TTC\Documents\Arduino\libraries\EthernetWebServer-master\src/Ethernet_HTTPClient/Ethernet_HttpClient.h:43,

             from C:\Users\TTC\Documents\Arduino\libraries\EthernetWebServer-master\src\Ethernet_HTTPClient\Ethernet_HttpClient.cpp:44:

C:\Program Files (x86)\Arduino\hardware\teensy\avr\cores\teensy4/Stream.h:68:6: error: 'int Stream::timedRead()' is private

int timedRead();

  ^

C:\Users\TTC\Documents\Arduino\libraries\EthernetWebServer-master\src\Ethernet_HTTPClient\Ethernet_HttpClient.cpp:642:23: error: within this context

 int c = timedRead();

                   ^

Multiple libraries were found for "Ethernet.h"
Used: C:\Program Files (x86)\Arduino\libraries\Ethernet
Not used: C:\Program Files (x86)\Arduino\hardware\teensy\avr\libraries\Ethernet-master
Error compiling for board Teensy 4.1.

Arduino Mega not work pin SS

Good day,

if I use Arduino Mega output number 53 for SS pin, wiznet 5500 is not functional. If I use pin 10 Arduino, everything works.

Used standard ethernet library in version 2.0.0.

server.authenticate problem

If I use newest ver. 1.8.1 (when I use 1.7.0 work correct)

  • I get problem with server.authenticate
  • server.on(F("/"), {
    if (!server.authenticate(www_username, www_password))
    {
    return server.requestAuthentication();
    }
    server.send(200, F("text/plain"), F("Login OK"));
    });

If you call above you don't get LOGIN windows, but clear window and callin finis with :
return server.requestAuthentication();

  • I testing on ESP32-S2 + W5500 + Ehtrenet3 lib (this lib I patchet library)

Unable to Compile Any EthernetWebServer Examples on ESP32-Wrover-E

I have tried multiple items at this point, to include reinstalls and different machines on Windows 10. I have verified the prereqs per the instructions here--I was working offline, so I also checked on an online machine with the latest direct downloads for dependencies etc. I should note that I used the following ESP32 ethernet example and verified that my W5500 board and my ESP32 Devkitc_v4 board with wrover-E chip are functional and connecting properly otherwise--https://github.com/PuceBaboon/ESP32_W5500_NTP_CLIENT.

Finally, I tried variations of the fix for the Server.h file and made sure that the ethernet.h, ethernet.cpp, and ethernetserver.cpp are the correct fixes per recommendations.

I get the below-pasted set of errors when I try to compile, and it is the same in all variations on both machines and in different versions. It seems to be a type mismatch or something. I have the board manager set at 115200 baud speed, correct port, ESP32 Wrover Module board selected, and default 4MB partition scheme with SPIFFS.

I am just beginning to approach code professionally, so assistance on this for a poor former Controls Engineer would be greatly appreciated. I really need this to work. I am trying to flesh out an ethernet connection that can connect to a basic HTML/HTTP website for external control, (no PoE won't work here, and no Wi-Fi is not an option), so I'd take recommendations as well for alternate paths to make something exactly like this work but for ethernet https://randomnerdtutorials.com/esp32-access-point-ap-web-server/.

In file included from C:\Users\admin\AppData\Local\Temp\arduino_modified_sketch_839864\WebServer.ino:15:0:
sketch\defines.h:235:4: warning: #warning Use ESP32 architecture [-Wcpp]
   #warning Use ESP32 architecture
    ^
In file included from C:\Users\admin\AppData\Local\Temp\arduino_modified_sketch_839864\WebServer.ino:15:0:
sketch\defines.h:329:8: warning: #warning Using Ethernet lib [-Wcpp]
       #warning Using Ethernet lib
        ^
In file included from sketch\defines.h:344:0,
                 from C:\Users\admin\AppData\Local\Temp\arduino_modified_sketch_839864\WebServer.ino:15:
C:\Users\admin\Documents\Arduino\libraries\EthernetWebServer\src/EthernetWebServer.h:94:4: warning: #warning Using 
Ethernet library from EthernetWebServer [-Wcpp]
   #warning Using Ethernet library from EthernetWebServer
    ^
In file included from sketch\defines.h:344:0,
                 from C:\Users\admin\AppData\Local\Temp\arduino_modified_sketch_839864\WebServer.ino:15:
C:\Users\admin\Documents\Arduino\libraries\EthernetWebServer\src/EthernetWebServer.h:109:4: warning: #warning 
SENDCONTENT_P_BUFFER_SZ using default 4 Kbytes [-Wcpp]
   #warning SENDCONTENT_P_BUFFER_SZ using default 4 Kbytes
    ^
In file included from sketch\defines.h:344:0,
                 from C:\Users\admin\AppData\Local\Temp\arduino_modified_sketch_839864\WebServer.ino:15:
C:\Users\admin\Documents\Arduino\libraries\EthernetWebServer\src/EthernetWebServer.h:326:21: error: cannot declare field 
'EthernetWebServer::_server' to be of abstract type 'EthernetServer'
     EthernetServer  _server;
                     ^
In file included from sketch\defines.h:328:0,
                 from C:\Users\admin\AppData\Local\Temp\arduino_modified_sketch_839864\WebServer.ino:15:
C:\Program Files (x86)\Arduino\libraries\Ethernet\src/Ethernet.h:253:7: note:   because the following virtual functions are pure 
within 'EthernetServer':
class EthernetServer : public Server {
       ^
In file included from 
C:\Users\admin\AppData\Local\Arduino15\packages\esp32\hardware\esp32\1.0.4\cores\esp32/Arduino.h:152:0,
                 from sketch\WebServer.ino.cpp:1:
C:\Users\admin\AppData\Local\Arduino15\packages\esp32\hardware\esp32\1.0.4\cores\esp32/Server.h:28:18: note: 	virtual 
void Server::begin(uint16_t)
     virtual void begin(uint16_t port=0) =0;
                  ^
WebServer:19:16: error: cannot declare variable 'server' to be of abstract type 'EthernetServer'
 EthernetServer server(80);
                ^
exit status 1
cannot declare variable 'server' to be of abstract type 'EthernetServer'

Also, I tried to use the Arduino base ethernet webserver example and get the below similar issue.
Web Server

A simple web server that shows the value of the analog input pins.
using an Arduino Wiznet Ethernet shield.

Circuit:

  • Ethernet shield attached to pins 10, 11, 12, 13
  • Analog inputs attached to pins A0 through A5 (optional)

created 18 Dec 2009
by David A. Mellis
modified 9 Apr 2012
by Tom Igoe
modified 02 Sept 2015
by Arturo Guadalupi

WebServer:33:16: error: cannot declare variable 'server' to be of abstract type 'EthernetServer'
 EthernetServer server(80);
                 ^
In file included from C:\Program Files (x86)\Arduino\libraries\Ethernet\examples\WebServer\WebServer.ino:21:0:
C:\Program Files (x86)\Arduino\libraries\Ethernet\src/Ethernet.h:253:7: note:   because the following virtual functions are pure 
within 'EthernetServer':
 class EthernetServer : public Server {
       ^
   In file included from 
    C:\Users\admin\AppData\Local\Arduino15\packages\esp32\hardware\esp32\1.0.4\cores\esp32/Arduino.h:152:0,
                    from sketch\WebServer.ino.cpp:1:
    C:\Users\admin\AppData\Local\Arduino15\packages\esp32\hardware\esp32\1.0.4\cores\esp32/Server.h:28:18: note: 	 
virtual 
    void Server::begin(uint16_t)
         virtual void begin(uint16_t port=0) =0;
                      ^
    exit status 1
    cannot declare variable 'server' to be of abstract type 'EthernetServer'

ADAFRUIT METRO M4 EXPRESS AIRLIFT (WIFI) - LITE problems

Hi,
Having issues with metro m4 airlift. I have tried w5100 and w5500 and ethernet, ethernet2, ethernet3 libraries and I always get 0.0.0.0

Starting WebServer on SAMD51 ADAFRUIT_METRO_M4_AIRLIFT_LITE with W5x00 using Ethernet Library
[ETHERNET_WEBSERVER] =========== USE_ETHERNET ===========
[ETHERNET_WEBSERVER] Default SPI pinout:
[ETHERNET_WEBSERVER] MOSI: 26
[ETHERNET_WEBSERVER] MISO: 24
[ETHERNET_WEBSERVER] SCK: 25
[ETHERNET_WEBSERVER] SS: 36
[ETHERNET_WEBSERVER] =========================
[ETHERNET_WEBSERVER] Board : SAMD51 ADAFRUIT_METRO_M4_AIRLIFT_LITE , setCsPin: 10

Currently Used SPI pinout:
MOSI:26
MISO:24
SCK:25
SS:36

Using mac index = 3
EthernetWebServer started @ IP address: 0.0.0.0

Feature Request: Add a RequestHandler subclass which passes the server to the function

Hello,

I am currently examining the feasibility of switching from our current custom (but extremely fast) Arduino web server code.
In doing so, I noticed that the default on methods, and FunctionRequestHandler only call functions which have no arguments.

That is a serious issue, since it means the server code must be a global, and breaks all sorts of best practices.

My cheap and dirty work around is something like this, but due to the next bug, I can't even test it with our current code base.

typedef vl::Func<void(EthernetWebServer&)> THandlerFunctionWithServer;
class FunctionRequestHandlerWithServer: public FunctionRequestHandler {
public:
    FunctionRequestHandlerWithServer(THandlerFunctionWithServer fn,
                                     THandlerFunctionWithServer ufn, const String &uri, HTTPMethod method)
    : FunctionRequestHandler([](){}, [](){}, uri, method), _fns(fn), _ufns(ufn)
    {
    }

    bool handle(EthernetWebServer& server, HTTPMethod requestMethod, String requestUri) override
    {
        ETW_UNUSED(server);

        if (!canHandle(requestMethod, requestUri))
            return false;

        _fns(server);
        return true;
    }

    void upload(EthernetWebServer& server, String requestUri, HTTPUpload& upload) override
    {
        ETW_UNUSED(server);
        ETW_UNUSED(upload);

        if (canUpload(requestUri))
            _ufns(server);
    }

protected:
    THandlerFunctionWithServer _fns;
    THandlerFunctionWithServer _ufns;
};

void handlerFunction(EthernetWebServer& server) {
    server.send(404, "application/json", "Something";
}

Edit:
With something like this, the EthernetServer().on(...) functions can be overloaded to support both versions.

NTP Server not working on teensy 4.1

Thank you for your efforts in continuing to update the library.

I tried the NTP example. The Teensy 4.1 gets an IP address but does not receive a response from the NTP server.

I tried changing the timeserver address to "129.6.15.28", but still no response.

Arduino hangs after repeated refreshing

I have set up a simple sketch that serves a html on /login. Here is the code

#include <Ethernet.h>
#include <EthernetWebServer.h>

#define webpage F("<!DOCTYPE html><html><head><title>Redacted - Login</title><link rel=stylesheet href=https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css crossorigin=anonymous><meta name=viewport content=\"width=device-width, initial-scale=1, shrink-to-fit=no\"><script src=scripts/auth.js></script><script>function onLoginButtonClick(){let passwordAlert=document.getElementById(\"passwordAlert\");let password=document.getElementById(\"password\");let remindme=document.getElementById(\"remindme\");login(password.value,remindme.checked,function(){window.location=\"/home\"},function(){passwordAlert.hidden=false})};</script></head><body><div style=\"max-width:280px;margin:60px auto 10px\"><div class=form-group action=/api/login><label for=username>Username</label><input type=text class=form-control value=admin id=username readonly></div><div class=form-group><label for=password>Password</label><input type=password class=form-control id=password placeholder=Password></div><div class=form-check><input type=checkbox class=form-check-input id=remindme><label class=form-check-label for=remindme>Ricordami per 14 giorni</label></div><button style=\"margin:15px auto\" onclick=onLoginButtonClick() class=\"btn btn-primary\">Login</button><div class=\"alert alert-danger\" role=alert id=passwordAlert hidden=true>Password errata</div></div><script src=https://code.jquery.com/jquery-3.2.1.slim.min.js integrity=sha384-KJ3o2DKtIkvYIK3UENzmM7KCkRr/rE9/Qpg6aAZGJwFDMVNA/GpGFF93hXpG5KkN crossorigin=anonymous></script><script src=https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.12.9/umd/popper.min.js integrity=sha384-ApNbgh9B+Y1QKtv3Rn7W3mgPxhU9K/ScQsAP7hUibX39j7fakFPskvXusvfa0b4Q crossorigin=anonymous></script><script src=https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/js/bootstrap.min.js integrity=sha384-JZR6Spejh4U02d8jOt6vLEHfe/JQGiRRSQQxSfFWpi1MquVdAyjUar5+76PVCmYl crossorigin=anonymous></script></body></html>") // 1923 bytes. I have applied the patch.

EthernetWebServer webServer;


byte mac[] = {0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA };
void setup()
{
  Ethernet.init(5);
  SerialUSB.begin(9600);

  Ethernet.begin(mac, IPAddress(192, 168, 1, 177), IPAddress(192, 168, 1, 1), IPAddress(192, 168, 1, 1), IPAddress(255, 255, 255, 0)); // 'settings' is a struct declared elsewhere.
  webServer = EthernetWebServer(80);

  webServer.on("/login", [](){ // /login handler
    webServer.send(200, "text/html", webpage);
  });
}

void loop()
{
  webServer.handleClient();
}

Everything works fine and the load time is not too slow. The problem is that when I load the page multiple times (aka. Send multiple GET requests with my browser), after the sixth time I refresh, the Arduino hangs. Everything gets blocked, I've checked the loop() with some SerialUSB.println(), and indeed it is frozen. This is probably the Arduino running out of SRAM causing the problem.
The device itself is an Arduino Zero compatible board with a ARM Cortex M0+ processor, so 256kB of Flash and 32kB of SRAM and the ethernet hardware is a W5500.

EthernetWebServer does not read and send html.h file to web browser

Hello Khoih,

I am trying to read a file test.h containing html code to send it to the web browser but shows a blank page. I am using Arduino Mega and Ethernet shield W5100 Wiznet.

#include test.h

void handleRootl()
{
String root_code = html_page;
server.send(200,"text/html",root_code);
}

test.h file contains:

const char html_page[] PROGMEM = R"=====(
<!DOCTYPE HTML>

<html> ........ </html>
)=====";

The sketch works fine with ESP8266WebServer. Please let me know how to solve it.

Wemos D1 mini and W5500 not work in standard SS/CS pin

if I connect W5500 and Wemos D1 mini (esp8266) using the default settings (for CS pin a connection with a transistor according to: https://esp8266hints.wordpress.com/2018/02/13/adding-an-ethernet-port-to is used -your-esp-revisited /) the following libraries do not work:

  • Ethernet (arduino v.2.0.0) - not work, + unexpected system restarts

  • Ethernet3 (v.1.5) - not work default cs/ss pin , after changing the pin to GPIO5 (wemos D1) it works fully (another suitable pin can be used). It is even possible to use the default pin, but it must be declared Ethernet.setCsPin (15);

  • Ethernet2 (v.1.0.4) - not work, (works but need to add code Ethernet.init(15)), as the previous case

There is no IP assignment, no correct communication
HTTP EthernetWebServer is @ IP : (IP unset)

Error During compilation for ESP32 + W5500 "cannot declare variable 'server' to be of abstract type 'EthernetServer'"

Arduino: 1.8.13 (Windows 10), Board: "ESP32 Dev Module, Enabled, Default 4MB with spiffs (1.2MB APP/1.5MB SPIFFS), 240MHz (WiFi/BT), QIO, 80MHz, 4MB (32Mb), 921600, None"

--------cut--------

IC:\Users\andrew\AppData\Local\Arduino15\packages\esp32\hardware\esp32\1.0.4\cores\esp32" "-IC:\Users\andrew\AppData\Local\Arduino15\packages\esp32\hardware\esp32\1.0.4\variants\esp32" "-IC:\Users\andrew\AppData\Local\Arduino15\packages\esp32\hardware\esp32\1.0.4\libraries\SPI\src" "-IC:\Users\andrew\Documents\Arduino\libraries\EthernetWebServer\src" "-IC:\Users\andrew\Documents\Arduino\libraries\Functional-Vlpp\src" "-IC:\Program Files (x86)\Arduino\libraries\Ethernet\src" "Q:\TMP\arduino_build_771611\sketch\EthernetLarge.cpp" -o "Q:\TMP\arduino_build_771611\sketch\EthernetLarge.cpp.o"

In file included from Q:\TMP\arduino_build_771611\sketch\defines.h:348:0,

             from C:\Users\andrew\Documents\Arduino\Training\EthernetWebServer\EthernetWebServer.ino:44:

C:\Users\andrew\Documents\Arduino\libraries\EthernetWebServer\src/EthernetWebServer.h:324:21: error: cannot declare field 'EthernetWebServer::_server' to be of abstract type 'EthernetServer'

 EthernetServer  _server;

                 ^

In file included from Q:\TMP\arduino_build_771611\sketch\defines.h:314:0,

             from C:\Users\andrew\Documents\Arduino\Training\EthernetWebServer\EthernetWebServer.ino:44:

Q:\TMP\arduino_build_771611\sketch\EthernetLarge.h:293:7: note: because the following virtual functions are pure within 'EthernetServer':

class EthernetServer : public Server {

   ^

In file included from C:\Users\andrew\AppData\Local\Arduino15\packages\esp32\hardware\esp32\1.0.4\cores\esp32/Arduino.h:152:0,

             from Q:\TMP\arduino_build_771611\sketch\EthernetWebServer.ino.cpp:1:

C:\Users\andrew\AppData\Local\Arduino15\packages\esp32\hardware\esp32\1.0.4\cores\esp32/Server.h:28:18: note: virtual void Server::begin(uint16_t)

 virtual void begin(uint16_t port=0) =0;

              ^

EthernetWebServer:48:16: error: cannot declare variable 'server' to be of abstract type 'EthernetServer'

EthernetServer server(80);

            ^

Using library SPI at version 1.0 in folder: C:\Users\andrew\AppData\Local\Arduino15\packages\esp32\hardware\esp32\1.0.4\libraries\SPI

Using library EthernetWebServer at version 1.0.13 in folder: C:\Users\andrew\Documents\Arduino\libraries\EthernetWebServer

Using library Functional-Vlpp at version 1.0.1 in folder: C:\Users\andrew\Documents\Arduino\libraries\Functional-Vlpp

Using library Ethernet at version 2.0.0 in folder: C:\Program Files (x86)\Arduino\libraries\Ethernet

exit status 1

cannot declare variable 'server' to be of abstract type 'EthernetServer'

Udp Multicast

Hello,

I am trying to make the UdpSendReceive example work in Multicast mode, it receive all the packets I send, but it never sends the reply message.

The unicast mode works as it should.

I just changed the line Udp.begin(localPort); to Udp.beginMulticast(IPAddress(23,255,255,250),1900);

#include "defines.h"

unsigned int localPort = 1900;    //10002;  // local port to listen on

char packetBuffer[255];          // buffer to hold incoming packet
char ReplyBuffer[] = "ACK";      // a string to send back

// A UDP instance to let us send and receive packets over UDP
EthernetUDP Udp;

void setup()
{
    Serial.begin(115200);
    while (!Serial);

    Serial.print("\nStart UDPSendReceive on "); Serial.print(BOARD_NAME);
    Serial.print(F(" with ")); Serial.println(SHIELD_TYPE);
    Serial.println(ETHERNET_WEBSERVER_VERSION);

    Ethernet.init(5);

    // start the ethernet connection and the server:
    // Use DHCP dynamic IP and random mac
    uint16_t index = millis() % NUMBER_OF_MAC;
    // Use Static IP
    //Ethernet.begin(mac[index], ip);
    Ethernet.begin(mac[index]);

    if (Ethernet.hardwareStatus() == EthernetNoHardware)
    {
        Serial.println("No Ethernet found. Stay here forever");

        while (true)
        {
            delay(1); // do nothing, no point running without Ethernet hardware
        }
    }

    if (Ethernet.linkStatus() == LinkOFF)
    {
        Serial.println("Not connected Ethernet cable");
    }


    Serial.print(F("Using mac index = "));
    Serial.println(index);

    Serial.print(F("Connected! IP address: "));
    Serial.println(Ethernet.localIP());

    Serial.println(F("\nStarting connection to server..."));
    // if you get a connection, report back via serial:
    Udp.beginMulticast(IPAddress(23,255,255,250),1900);

    Serial.print(F("Listening on port "));
    Serial.println(localPort);
}

void loop()
{
    // if there's data available, read a packet
    int packetSize = Udp.parsePacket();

    if (packetSize)
    {
        Serial.print(F("Received packet of size "));
        Serial.println(packetSize);
        Serial.print(F("From "));
        IPAddress remoteIp = Udp.remoteIP();
        Serial.print(remoteIp);
        Serial.print(F(", port "));
        Serial.println(Udp.remotePort());

        // read the packet into packetBufffer
        int len = Udp.read(packetBuffer, 255);

        if (len > 0)
        {
            packetBuffer[len] = 0;
        }

        Serial.println(F("Contents:"));
        Serial.println(packetBuffer);

        // send a reply, to the IP address and port that sent us the packet we received
        Udp.beginPacket(Udp.remoteIP(), Udp.remotePort());
        Udp.write(ReplyBuffer, strlen(ReplyBuffer));
        Udp.endPacket();
    }
}

Is there something missing in the code to make the multicast works ?

ESP32 heap corrupting after update to 1.4.0 or 1.5.0

Hi,
I have finished ESP32 project with your great library, which periodically send json file as response to AJAX request.
Wifi and BT are off. Everything works fine, but after update my version 1.3.1 to 1.4.0 or 1.5.0 after each response is free heap memory decreased by 56 bytes until system crash.
All is fine with version 1.3.1.

Decoded exception is atached


Decoding stack results
0x400f94c5: panic_abort at ../esp-idf/components/esp_system/panic.c line 365
0x40091d51: esp_system_abort at ../esp-idf/components/esp_system/esp_system.c line 126
0x40097845: abort at ../esp-idf/components/newlib/abort.c line 46
0x4017a86f: __cxxabiv1::__terminate(void (*)()) at /builds/idf/crosstool-NG/.build/HOST-i686-w64-mingw32/xtensa-esp32-elf/src/gcc/libstdc++-v3/libsupc++/eh_terminate.cc line 47
0x4017a8b6: std::terminate() at /builds/idf/crosstool-NG/.build/HOST-i686-w64-mingw32/xtensa-esp32-elf/src/gcc/libstdc++-v3/libsupc++/eh_terminate.cc line 57
0x4017a33d: __cxxabiv1::__cxa_allocate_exception(std::size_t) at /builds/idf/crosstool-NG/.build/HOST-i686-w64-mingw32/xtensa-esp32-elf/src/gcc/libstdc++-v3/libsupc++/eh_alloc.cc line 300
0x4017a16c: operator new(unsigned int) at /builds/idf/crosstool-NG/.build/HOST-i686-w64-mingw32/xtensa-esp32-elf/src/gcc/libstdc++-v3/libsupc++/new_op.cc line 54
0x400d5e8b: EthernetWebServer::_prepareHeader(String&, int, char const*, unsigned int) at D:\Moje projekty\ARDUINO PROJEKTY\libraries\EthernetWebServer\src/EthernetWebServer-impl.h line 456
0x400d5f89: EthernetWebServer::send(int, char const*, String const&) at C:\Users\ppt\AppData\Local\Arduino15\packages\esp32\hardware\esp32\2.0.0-alpha1\cores\esp32/WString.h line 322
0x400e2701: HandleSystemInfo() at C:\Users\ppt\AppData\Local\Temp\arduino_build_378874\sketch/ServerStream.h line 206
0x40188555: vl::internal_invokers::StaticInvoker ::Invoke() at D:\Moje projekty\ARDUINO PROJEKTY\libraries\Functional-Vlpp\src/Function.h line 75
0x400d36a2: FunctionRequestHandler::handle(EthernetWebServer&, HTTPMethod, String) at D:\Moje projekty\ARDUINO PROJEKTY\libraries\Functional-Vlpp\src/Function.h line 197
0x400d642b: EthernetWebServer::_handleRequest() at D:\Moje projekty\ARDUINO PROJEKTY\libraries\EthernetWebServer\src/EthernetWebServer-impl.h line 820
0x400d87e0: EthernetWebServer::handleClient() at D:\Moje projekty\ARDUINO PROJEKTY\libraries\EthernetWebServer\src/EthernetWebServer-impl.h line 224
0x400e0852: loop() at D:\Moje projekty\ARDUINO PROJEKTY\DAS16_ESP32_NEW/DAS16_ESP32_NEW.ino line 259
0x400f3125: loopTask(void*) at C:\Users\ppt\AppData\Local\Arduino15\packages\esp32\hardware\esp32\2.0.0-alpha1\cores\esp32\main.cpp line 39

Spiffs not work

I am using esp32 + w5500. The output of the index.html file to the web site via spiffs does not work. Simple helloserver works. I used this construction in standard webserver.h + esp32 via WiFi. Everything works. Plz help.

#include <FS.h>  // Библиотека для работы с файловой системой
#include <SPIFFS.h>
#include <SPI.h>
#include <Ethernet.h>
bool tcp_session = false;
bool EthernetUsable = false;  // W5500 found??

#define W5500_RST_PORT   21
byte mac[] = {  0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };
#define EthernetLinkUP_Retries  10  //

#include <EthernetWebServer.h>
EthernetWebServer HTTP(80);

void setup() 
{

Serial.begin(115200);                                                   // Инициализируем вывод данных на серийный порт со скоростью 9600 бод
  SPIFFS.begin();                                                       // Инициализируем работу с файловой системой                          

Serial.println("Used/default ESP32 pinout:");
Serial.print("MOSI:");
Serial.println(MOSI);
Serial.print("MISO:");
Serial.println(MISO);
Serial.print("SCK:");
Serial.println(SCK);
Serial.print("SS:");
Serial.println(SS);
//  Serial.println(RST);
Serial.print("Reset:");
Serial.println(W5500_RST_PORT);

SPI.begin();

Serial.println("Resetting WizNet for consistent results");
pinMode(W5500_RST_PORT, OUTPUT);
digitalWrite(W5500_RST_PORT, LOW);
delayMicroseconds(500);
digitalWrite(W5500_RST_PORT, HIGH);
delayMicroseconds(1000);

Ethernet.init(SS);

Serial.println("Starting ethernet");
Ethernet.begin(mac);
//Ethernet.begin(mac,ip);
//delay(1000);
vTaskDelay(1000 / portTICK_RATE_MS);

switch (Ethernet.hardwareStatus()) {
case EthernetNoHardware:
  Serial.println("Ethernet Hardware was not found, can't continue...");
  EthernetUsable = false;
  break;
case EthernetW5100:
  Serial.println("W5100 hardware found");
  EthernetUsable = true;
  break;
case EthernetW5200:
  Serial.println("W5200 hardware found");
  EthernetUsable = true;
  break;
case EthernetW5500:
  Serial.println("W5500 hardware found");
  EthernetUsable = true;
  break;
default:
  Serial.print("Undefined hardware found:");
  Serial.println(Ethernet.hardwareStatus());
  Serial.print("No Hardware value::");
  Serial.println(EthernetNoHardware);
  EthernetUsable = false;  // not acceptable

  break;
}

int retries = 0;
do {
//delay(500);
vTaskDelay(500 / portTICK_RATE_MS);

switch (Ethernet.linkStatus()) {
  case Unknown:
    Serial.println("Unknown link status");
    EthernetUsable = false;
    break;
  case LinkOFF:
    Serial.println("LinkOFF");
    EthernetUsable = false;
    break;
  case LinkON:
    Serial.println("LinkON");
    EthernetUsable = true;
    break;
  default:
    EthernetUsable = false;
    Serial.println("Undefined link status");
}
} while ( (Ethernet.linkStatus() != LinkON ) && retries++ < EthernetLinkUP_Retries );


if (EthernetUsable == true) {
// https://www.pjrc.com/arduino-ethernet-library-2-0-0/
Serial.print("LocalIP:");
Serial.println(Ethernet.localIP());

Serial.print("GW:");
Serial.println(Ethernet.gatewayIP());

Serial.print("Subnet Netmask:");
Serial.println(Ethernet.subnetMask());

Serial.print("DNS Server IP:");
Serial.println(Ethernet.dnsServerIP());

//Serial.print("MAC:");
//Serial.println(Ethernet.MACAddress());

}

HTTP.begin();

HTTP.on("/", [](){                                        
if(!handleFileRead(HTTP.uri()))                                       // Если функция handleFileRead (описана ниже) возвращает значение false в ответ на поиск файла в файловой системе
  HTTP.send(404, "text/plain", "Not Found");                        // возвращаем на запрос текстовое сообщение "File isn't found" с кодом 404 (не найдено)                  
});

HTTP.on("/index.html", [](){                                        
if(!handleFileRead(HTTP.uri()))                                       // Если функция handleFileRead (описана ниже) возвращает значение false в ответ на поиск файла в файловой системе
  HTTP.send(404, "text/plain", "Not Found");                        // возвращаем на запрос текстовое сообщение "File isn't found" с кодом 404 (не найдено)                  
});

HTTP.onNotFound([](){                                                 // Описываем действия при событии "Не найдено"
if(!handleFileRead(HTTP.uri()))                                       // Если функция handleFileRead (описана ниже) возвращает значение false в ответ на поиск файла в файловой системе
  HTTP.send(404, "text/plain", "Not Found");                        // возвращаем на запрос текстовое сообщение "File isn't found" с кодом 404 (не найдено)
});

}

void loop() {
HTTP.handleClient();  
}

bool handleFileRead(String path){                                       // Функция работы с файловой системой

//Serial.println(HTTP.uri());
if(path.endsWith("/")) path += "index.html";                          // Если устройство вызывается по корневому адресу, то должен вызываться файл index.html (добавляем его в конец адреса)
if(path.endsWith("/genaset")) path += ".html";
if(path.endsWith("/networksetting")) path += ".html";
String contentType = getContentType(path);                            // С помощью функции getContentType (описана ниже) определяем по типу файла (в адресе обращения) какой заголовок необходимо возвращать по его вызову
if(SPIFFS.exists(path)){                                              // Если в файловой системе существует файл по адресу обращения
File file = SPIFFS.open(path, "r");                                 //  Открываем файл для чтения
Serial.print("path=");
Serial.println(path);
Serial.print("filename=");
Serial.println(file.size());
Serial.print("content=");
Serial.println(contentType);
size_t sent = HTTP.streamFile(file, contentType);                   //  Выводим содержимое файла по HTTP, указывая заголовок типа содержимого contentType
file.close();                                                       //  Закрываем файл
return true;                                                        //  Завершаем выполнение функции, возвращая результатом ее исполнения true (истина)
}
return false;                                                         // Завершаем выполнение функции, возвращая результатом ее исполнения false (если не обработалось предыдущее условие)
}

String getContentType(String filename){                                 // Функция, возвращающая необходимый заголовок типа содержимого в зависимости от расширения файла
  if (filename.endsWith(".html")) return "text/html";                   // Если файл заканчивается на ".html", то возвращаем заголовок "text/html" и завершаем выполнение функции
  else if (filename.endsWith(".css")) return "text/css";                // Если файл заканчивается на ".css", то возвращаем заголовок "text/css" и завершаем выполнение функции
  else if (filename.endsWith(".js")) return "application/javascript";   // Если файл заканчивается на ".js", то возвращаем заголовок "application/javascript" и завершаем выполнение функции
  else if (filename.endsWith(".png")) return "image/png";               // Если файл заканчивается на ".png", то возвращаем заголовок "image/png" и завершаем выполнение функции
  else if (filename.endsWith(".jpg")) return "image/jpeg";              // Если файл заканчивается на ".jpg", то возвращаем заголовок "image/jpg" и завершаем выполнение функции
  else if (filename.endsWith(".gif")) return "image/gif";               // Если файл заканчивается на ".gif", то возвращаем заголовок "image/gif" и завершаем выполнение функции
  else if (filename.endsWith(".ico")) return "image/x-icon";            // Если файл заканчивается на ".ico", то возвращаем заголовок "image/x-icon" и завершаем выполнение функции
  return "text/plain";                                                  // Если ни один из типов файла не совпал, то считаем что содержимое файла текстовое, отдаем соответствующий заголовок и завершаем выполнение функции
}

Break of min and max functions on Arduino Sam Due

Hi, I'm trying to use you library but after adding it to my project I get an error on min and max functions that was previous inside my code.
Before adding your library everything works well.
I've patched platform.txt for SAM Due, as you said. I'm using also EthernetENC.
Is It my fault? I forgot to patch something?
To make my code working again I've to put this definitions after including your library:

#ifndef max
#define max(a,b) (((a) > (b)) ? (a) : (b))
#endif

#ifndef min
#define min(a,b) (((a) < (b)) ? (a) : (b))
#endif

Thanks,
Paolo

AdvancedWebServer example give me wrong ip HTTP EthernetWebServer is @ IP : 1.0.1.0

i download and try to use a lib from you and simple example with RPI2040 PICO evb board with w5100S.

the chip in RPI2040 PICO LAN WIZ NET BOARD IS W5100S, S-letter after w5100. if this is important for your software i think need to rework a little.

i read the code that you write for spi pins for this evb board. serial monitor say that is connected but ip is not of dhcp or static that i try to give to make web server active in my network
here is some info from serial monitor :

Starting AdvancedWebServer on MBED RASPBERRY_PI_PICO with W5x00 using EthernetLarge Library
EthernetWebServer v2.0.1
[EWS] =========== USE_ETHERNET_LARGE ===========
[EWS] Default SPI pinout:
[EWS] MOSI: 19
[EWS] MISO: 16
[EWS] SCK: 18
[EWS] SS: 17
[EWS] =========================
[EWS] RPIPICO setCsPin: 5
=========================
Currently Used SPI pinout:
MOSI:19
MISO:16
SCK:18
SS:17
=========================
Using mac index = 17
Connected! IP address: 0.1.0.1
HTTP EthernetWebServer is @ IP : 1.0.1.0
.......... .......... .......... .......... .......... .......... .....

waiting for response. my router is mikrotik and network is simple like 192.168.88.1-254 but no success

Something wrong in http response header

Hi
I'm using this library for my ESP32 and w5100 ethernet board.
Recently I found that there's unexpected chars (0x20, 0x91) in http reponse after "HTTP/1.1" and no http status code which causes http basic auth fail and something strange .
Is there anything I can do or maybe to get an update?
Thanks for help.

@v1.81 + Arduino 1.8.16 + Ethernet.h

WiFi and Ethernet Bridge?

Perhaps I'm missing this ability as an inherent part of the base libraries, but I cannot seem to get Wi-Fi and Ethernet servers to operate in one program. The intent is to connect one or the other based on if Ethernet is physically connected, or default to Wi-Fi if Ethernet isn't connected at startup. Removing Ethernet would start the Wi-Fi AP and server. Both listen for clients after switching.

I have not been able to successfully split the startup functions and declarations based on input feedback. I can compile a logic tree that starts one or the other, but there seems to be a problem with the class when trying to connect. It appears to me that the items to consider are as follows:

EthernetServer server( );
Ethernet.begin( );
EthernetClient client = server.available( );

WiFiServer server( );
WiFi.softAP( );
server.begin ( );
WiFiClient = server.available( );

Is it possible to merge these two functionally without major changes?

Consecutive page refreshes finally leads to data corruption and Connection Refused

Dear all, first of all i need to congratulate you on this wonderful library. I dont want to waste anyones time but I am desperate to find a solution. I can see that this topic is somehow similar to a previous one but I am confident that it is a valid case to be examined.

I am using an arduino Mega with an ethernet shield 2. The device is powered from USB cable directly connected to laptop. I have developed my own program and came across some issues that I couldnt explain. Finally i went back to the drawing board and conducted my tests with the Simple Authentication example as provided. I could replicate the issues with this example so it makes me think there is a bug somewhere in the library.

The bug is as follows: after consecutive refreshes the arduino starts sending less and less data and finally i get the message connection refused on the browser. The arduino seems to be stuck as it produces nothing. However it responds to pings Ok.

Here is some info on how to replicate the bug:

Arduino 1.8.13
Arduino Mega plus Ethernet Shield 2 featuring a W5500.
Example: Simple Authentication
Page to refresh: $IP ADDRESS$/login
Browser: Chrome and Firefox
Configuration settings: using either Ethernet or Ethernet2 library

Load the page and do about 200 refreshes. Refreshes should be done once the page is loaded. On every refresh the arduino should send 350 characters with the content

<html><body><form action='/login' method='POST'>To log in, please use : admin/password<br>User:<input type='text' name='USERNAME' placeholder='user name'><br>Password:<input type='password' name='PASSWORD' placeholder='password'><br><input type='submit' name='SUBMIT' value='Submit'></form><br>You also can go <a href='/inline'>here</a></body></html>

After 150-200 refreshes the arduino starts sending less and less characters. Please see provided log further down.

Also, if the refreshes are faster the arduino will also report corrupted data on its parsed received headers. Please see provided log further down.

Here is a perfect page refresh log that sends the full 350 character long web page:

13:03:10.270 -> [EWS] handleClient: New Client
13:03:10.304 -> [EWS] method:  GET
13:03:10.304 -> [EWS] url:  /login
13:03:10.304 -> [EWS] search:  
13:03:10.304 -> [EWS] headerName: Host
13:03:10.304 -> [EWS] headerValue: 192.168.1.30
13:03:10.304 -> [EWS] headerName: Connection
13:03:10.304 -> [EWS] headerValue: keep-alive
13:03:10.304 -> [EWS] headerName: Upgrade-Insecure-Requests
13:03:10.338 -> [EWS] headerValue: 1
13:03:10.372 -> [EWS] headerName: User-Agent
13:03:10.372 -> [EWS] headerValue: Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/95.0.4638.69 Safari/537.36
13:03:10.406 -> [EWS] headerName: Accept
13:03:10.406 -> [EWS] headerValue: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9
13:03:10.440 -> [EWS] headerName: Accept-Encoding
13:03:10.440 -> [EWS] headerValue: gzip, deflate
13:03:10.440 -> [EWS] headerName: Accept-Language
13:03:10.474 -> [EWS] headerValue: en-US,en;q=0.9,el;q=0.8
13:03:10.474 -> [EWS] headerName: Cookie
13:03:10.474 -> [EWS] headerValue: ESPSESSIONID=0
13:03:10.474 -> [EWS] args:  
13:03:10.474 -> [EWS] args count:  0
13:03:10.474 -> [EWS] args:  
13:03:10.474 -> [EWS] args count:  0
13:03:10.474 -> [EWS] Request: /login
13:03:10.474 -> [EWS] Arguments: 
13:03:10.474 -> [EWS] Final list of key/value pairs:
13:03:10.474 -> [EWS] _handleRequest handle
13:03:10.474 -> Found cookie: ESPSESSIONID=0
13:03:10.474 -> [EWS] send1: len =  350
13:03:10.507 -> [EWS] content =  <html><body><form action='/login' method='POST'>To log in, please use : admin/password<br>User:<input type='text' name='USERNAME' placeholder='user name'><br>Password:<input type='password' name='PASSWORD' placeholder='password'><br><input type='submit' name='SUBMIT' value='Submit'></form><br>You also can go <a href='/inline'>here</a></body></html>
13:03:10.541 -> [EWS] _prepareHeader sendHeader Conn close
13:03:10.541 -> [EWS] send1: write header =  HTTP/1.1 200 OK
13:03:10.541 -> Content-Type: text/html
13:03:10.541 -> Content-Length: 350
13:03:10.541 -> Connection: close
13:03:10.541 -> 
13:03:10.541 -> 
13:03:10.541 -> [EWS] sendContent: Client.write content:  <html><body><form action='/login' method='POST'>To log in, please use : admin/password<br>User:<input type='text' name='USERNAME' placeholder='user name'><br>Password:<input type='password' name='PASSWORD' placeholder='password'><br><input type='submit' name='SUBMIT' value='Submit'></form><br>You also can go <a href='/inline'>here</a></body></html>
13:03:10.576 -> [EWS] _handleRequest OK
13:03:10.576 -> [EWS] handleClient: Don't keepCurrentClient

After 150-200 refreshes it sends less data. In this case it sends 237 characters only.

13:09:09.095 -> [EWS] handleClient: New Client
13:09:09.129 -> [EWS] method:  GET
13:09:09.129 -> [EWS] url:  /login
13:09:09.129 -> [EWS] search:  
13:09:09.129 -> [EWS] headerName: Host
13:09:09.129 -> [EWS] headerValue: 192.168.1.30
13:09:09.129 -> [EWS] headerName: Connection
13:09:09.129 -> [EWS] headerValue: keep-alive
13:09:09.129 -> [EWS] headerName: Cache-Control
13:09:09.129 -> [EWS] headerValue: max-age=0
13:09:09.163 -> [EWS] headerName: Upgrade-Insecure-Requests
13:09:09.163 -> [EWS] headerValue: 1
13:09:09.197 -> [EWS] headerName: User-Agent
13:09:09.197 -> [EWS] headerValue: 
13:09:09.231 -> [EWS] headerName: Accept
13:09:09.231 -> [EWS] headerValue: text/html,application/xhtml+
13:09:09.264 -> [EWS] headerName: Accept-Encoding
13:09:09.264 -> [EWS] headerValue: gzip, deflate
13:09:09.264 -> [EWS] headerName: Accept-Language
13:09:09.264 -> [EWS] headerValue: en-US,en;q=0.9,el;q
13:09:09.264 -> [EWS] headerName: Cookie
13:09:09.299 -> [EWS] headerValue: ESPSESSIONID=0
13:09:09.299 -> [EWS] args:  
13:09:09.299 -> [EWS] args count:  0
13:09:09.299 -> [EWS] args:  
13:09:09.299 -> [EWS] args count:  0
13:09:09.299 -> [EWS] Request: /login
13:09:09.299 -> [EWS] Arguments: 
13:09:09.299 -> [EWS] Final list of key/value pairs:
13:09:09.299 -> [EWS] _handleRequest handle
13:09:09.299 -> Found cookie: ESPSESSIONID=0
13:09:09.299 -> [EWS] send1: len =  237
13:09:09.299 -> [EWS] content =  <html><body><form action='/login' method='POST'>To log in, please use : admin/password<br>User:<input type='text' name='USERNAME' placeholder='user name'><br>Password:<input type='password' name='PASSWORD' placeholder='password'><br><br>
13:09:09.335 -> [EWS] _prepareHeader sendHeader Conn close
13:09:09.335 -> [EWS] send1: write header =  HTTP/1.1 200 OK
13:09:09.335 -> Content-Type: text/html
13:09:09.335 -> Content-Length: 237
13:09:09.335 -> 
13:09:09.335 -> 
13:09:09.335 -> [EWS] sendContent: Client.write content:  <html><body><form action='/login' method='POST'>To log in, please use : admin/password<br>User:<input type='text' name='USERNAME' placeholder='user name'><br>Password:<input type='password' name='PASSWORD' placeholder='password'><br><br>
13:09:09.367 -> [EWS] _handleRequest OK
13:09:10.347 -> [EWS] handleClient: Don't keepCurrentClient

After a few more refreshes it sends 90 characters

13:12:08.727 -> [EWS] handleClient: New Client
13:12:08.727 -> [EWS] method:  GET
13:12:08.727 -> [EWS] url:  /login
13:12:08.727 -> [EWS] search:  
13:12:08.727 -> [EWS] headerName: Host
13:12:08.727 -> [EWS] headerValue: 192.168.1.30
13:12:08.760 -> [EWS] headerName: Connection
13:12:08.760 -> [EWS] headerValue: keep-alive
13:12:08.760 -> [EWS] headerName: Cache-Control
13:12:08.760 -> [EWS] headerValue: max-age=0
13:12:08.760 -> [EWS] headerName: Upgrade-Insecure-Requests
13:12:08.760 -> [EWS] headerValue: 1
13:12:08.794 -> [EWS] headerName: User-Agent
13:12:08.828 -> [EWS] headerValue: Mozilla/5.0 (Windows NT 6.1; Win
13:12:08.862 -> [EWS] headerName: Accept
13:12:08.862 -> [EWS] headerValue: text/html,ap
13:12:08.862 -> [EWS] headerName: Accept-Encoding
13:12:08.862 -> [EWS] headerValue: gzi
13:12:08.896 -> [EWS] headerName: Accept-Language
13:12:08.896 -> [EWS] headerValue: en-
13:12:08.896 -> [EWS] headerName: Cookie
13:12:08.896 -> [EWS] headerValue: ESPSESSIONID
13:12:08.896 -> [EWS] args:  
13:12:08.896 -> [EWS] args count:  0
13:12:08.896 -> [EWS] args:  
13:12:08.896 -> [EWS] args count:  0
13:12:08.896 -> [EWS] Request: /login
13:12:08.896 -> [EWS] Arguments: 
13:12:08.896 -> [EWS] Final list of key/value pairs:
13:12:08.930 -> [EWS] _handleRequest handle
13:12:08.930 -> Found cookie: ESPSESSIONID
13:12:08.930 -> [EWS] send1: len =  90
13:12:08.930 -> [EWS] content =  <html><body><form action='/login' method='POST'>To log in, please use : admin/password<br>
13:12:08.930 -> [EWS] _prepareHeader sendHeader Conn close
13:12:08.930 -> [EWS] send1: write header =  HTTP/1.1 200 OK
13:12:08.930 -> Content-Length: 90
13:12:08.930 -> 
13:12:08.930 -> 
13:12:08.930 -> [EWS] sendContent: Client.write content:  <html><body><form action='/login' method='POST'>To log in, please use : admin/password<br>
13:12:08.963 -> [EWS] _handleRequest OK
13:12:09.942 -> [EWS] handleClient: Don't keepCurrentClient

And eventually you get the ERR_CONNECTION_REFUSED from the browser. The arduino at this point seems to be stuck as it does not produce and logs but weirdly it responds to pings Ok.

image

image

Finally, when someone goes crazy with the page refresh and keeps refreshing very fast, i can see corrupted data on the headers too...See below (please note how the ip address is not correctly filled in):

22:08:19.519 -> [EWS] handleClient: New Client
22:08:19.519 -> [EWS] method:  GET
22:08:19.519 -> [EWS] url:  /login
22:08:19.519 -> [EWS] search:  
22:08:19.519 -> [EWS] headerName: Host
22:08:19.519 -> [EWS] headerValue: 192.168.1.
22:08:19.519 -> [EWS] args:  
22:08:19.519 -> [EWS] args count:  0
22:08:19.519 -> [EWS] args:  
22:08:19.519 -> [EWS] args count:  0
22:08:19.519 -> [EWS] Request: /login
22:08:19.519 -> [EWS] Arguments: 
22:08:19.554 -> [EWS] Final list of key/value pairs:
22:08:19.554 -> [EWS] _handleRequest handle
22:08:19.554 -> [EWS] send1: len =  68
22:08:19.554 -> [EWS] content =  User:<input type='text' name='USERNAME' placeholder='user name'><br>
22:08:19.554 -> [EWS] _prepareHeader sendHeader Conn close
22:08:19.554 -> [EWS] send1: write header =   
22:08:19.554 -> 
22:08:19.554 -> [EWS] sendContent: Client.write content:  User:<input type='text' name='USERNAME' placeholder='user name'><br>
22:08:19.554 -> [EWS] _handleRequest OK
22:08:19.589 -> [EWS] handleClient: Don't keepCurrentClient

and also some funny log that shows things really messed up

22:08:20.978 -> [EWS] handleClient: New Client
22:08:20.978 -> [EWS] method:  GET
22:08:20.978 -> [EWS] url:  /login
22:08:20.978 -> [EWS] search:  
22:08:20.978 -> [EWS] args:  
22:08:20.978 -> [EWS] args count:  0
22:08:20.978 -> [EWS] args:  
22:08:20.978 -> [EWS] args count:  0
22:08:21.012 -> [EWS] Request: /login
22:08:21.012 -> [EWS] Arguments: 
22:08:21.012 -> [EWS] Final list of key/value pairs:
22:08:21.012 -> [EWS] _handleRequest: request handler not found
22:08:21.012 -> [EWS] send1: len =  53
22:08:21.012 -> [EWS] content =  File Not Found
22:08:21.012 -> 
22:08:21.012 -> URI: /login
22:08:21.012 -> Method: GET
22:08:21.012 -> Arguments: 0
22:08:21.012 -> 
22:08:21.012 -> [EWS] _prepareHeader sendHeader Conn close
22:08:21.012 -> [EWS] send1: write header =   404 
22:08:21.012 -> 
22:08:21.012 -> 
22:08:21.012 -> [EWS] sendContent: Client.write content:  File Not Found
22:08:21.012 -> 
22:08:21.012 -> URI: /login
22:08:21.012 -> Method: GET
22:08:21.012 -> Arguments: 0
22:08:21.012 -> 
22:08:21.012 -> [EWS] handleClient: Don't keepCurrentClient
22:08:21.657 -> [EWS] handleClient: New Client
22:08:21.657 -> [EWS] _parseRequest: Invalid request:  GET /l
22:08:21.691 -> [EWS] handleClient: Don't keepCurrentClient
22:08:21.691 -> [EWS] handleClient: New Client
22:08:21.691 -> [EWS] _parseRequest: Invalid request:  Host: 
22:08:21.691 -> [EWS] handleClient: Don't keepCurrentClient
22:08:21.691 -> [EWS] handleClient: New Client
22:08:21.691 -> [EWS] _parseRequest: Invalid request:  Connec
22:08:21.691 -> [EWS] handleClient: Don't keepCurrentClient
22:08:21.691 -> [EWS] handleClient: New Client
22:08:21.725 -> [EWS] _parseRequest: Invalid request:  Cache-
22:08:21.725 -> [EWS] handleClient: Don't keepCurrentClient
22:08:21.725 -> [EWS] handleClient: New Client
22:08:21.725 -> [EWS] _parseRequest: Invalid request:  Upgrad
22:08:21.725 -> [EWS] handleClient: Don't keepCurrentClient
22:08:21.725 -> [EWS] handleClient: New Client
22:08:21.759 -> [EWS] _parseRequest: Invalid request:  User-A
22:08:21.759 -> [EWS] handleClient: Don't keepCurrentClient
22:08:21.793 -> [EWS] handleClient: New Client
22:08:21.827 -> [EWS] _parseRequest: Invalid request:  Accept
22:08:21.827 -> [EWS] handleClient: Don't keepCurrentClient
22:08:21.827 -> [EWS] handleClient: New Client
22:08:21.827 -> [EWS] _parseRequest: Invalid request:  Accept
22:08:21.827 -> [EWS] handleClient: Don't keepCurrentClient
22:08:21.827 -> [EWS] handleClient: New Client
22:08:21.861 -> [EWS] _parseRequest: Invalid request:  Accept
22:08:21.861 -> [EWS] handleClient: Don't keepCurrentClient
22:08:21.861 -> [EWS] handleClient: New Client
22:08:21.861 -> [EWS] _parseRequest: Invalid request:  Cookie
22:08:21.861 -> [EWS] handleClient: Don't keepCurrentClient
22:08:21.861 -> [EWS] handleClient: New Client
22:08:21.894 -> [EWS] _parseRequest: Invalid request:  
22:08:21.894 -> [EWS] handleClient: Don't keepCurrentClient
22:08:23.176 -> [EWS] handleClient: New Client
22:08:23.176 -> [EWS] _parseRequest: Invalid request:  GET /l
22:08:23.176 -> [EWS] handleClient: Don't keepCurrentClient
22:08:23.176 -> [EWS] handleClient: New Client
22:08:23.176 -> [EWS] _parseRequest: Invalid request:  Host: 
22:08:23.209 -> [EWS] handleClient: Don't keepCurrentClient
22:08:23.209 -> [EWS] handleClient: New Client
22:08:23.209 -> [EWS] _parseRequest: Invalid request:  Connec
22:08:23.209 -> [EWS] handleClient: Don't keepCurrentClient
22:08:23.209 -> [EWS] handleClient: New Client
22:08:23.209 -> [EWS] _parseRequest: Invalid request:  Cache-
22:08:23.209 -> [EWS] handleClient: Don't keepCurrentClient
22:08:23.209 -> [EWS] handleClient: New Client
22:08:23.243 -> [EWS] _parseRequest: Invalid request:  Upgrad
22:08:23.243 -> [EWS] handleClient: Don't keepCurrentClient
22:08:23.243 -> [EWS] handleClient: New Client
22:08:23.276 -> [EWS] _parseRequest: Invalid request:  User-A
22:08:23.276 -> [EWS] handleClient: Don't keepCurrentClient
22:08:23.276 -> [EWS] handleClient: New Client
22:08:23.344 -> [EWS] _parseRequest: Invalid request:  Accept
22:08:23.344 -> [EWS] handleClient: Don't keepCurrentClient
22:08:23.344 -> [EWS] handleClient: New Client
22:08:23.344 -> [EWS] _parseRequest: Invalid request:  Accept
22:08:23.344 -> [EWS] handleClient: Don't keepCurrentClient
22:08:23.344 -> [EWS] handleClient: New Client
22:08:23.378 -> [EWS] _parseRequest: Invalid request:  Accept
22:08:23.378 -> [EWS] handleClient: Don't keepCurrentClient
22:08:23.378 -> [EWS] handleClient: New Client
22:08:23.378 -> [EWS] _parseRequest: Invalid request:  Cookie
22:08:23.378 -> [EWS] handleClient: Don't keepCurrentClient
22:08:23.378 -> [EWS] handleClient: New Client
22:08:23.378 -> [EWS] _parseRequest: Invalid request:  
22:08:23.378 -> [EWS] handleClient: Don't keepCurrentClient
22:08:25.002 -> [EWS] handleClient: New Client
22:08:25.002 -> [EWS] _parseRequest: Invalid request:  GET /l
22:08:25.002 -> [EWS] handleClient: Don't keepCurrentClient
22:08:25.002 -> [EWS] handleClient: New Client
22:08:25.002 -> [EWS] _parseRequest: Invalid request:  Host: 
22:08:25.002 -> [EWS] handleClient: Don't keepCurrentClient
22:08:25.002 -> [EWS] handleClient: New Client
22:08:25.002 -> [EWS] _parseRequest: Invalid request:  Connec
22:08:25.036 -> [EWS] handleClient: Don't keepCurrentClient
22:08:25.036 -> [EWS] handleClient: New Client
22:08:25.036 -> [EWS] _parseRequest: Invalid request:  Cache-
22:08:25.036 -> [EWS] handleClient: Don't keepCurrentClient
22:08:25.036 -> [EWS] handleClient: New Client
22:08:25.036 -> [EWS] _parseRequest: Invalid request:  Upgrad
22:08:25.071 -> [EWS] handleClient: Don't keepCurrentClient
22:08:25.071 -> [EWS] handleClient: New Client
22:08:25.104 -> [EWS] _parseRequest: Invalid request:  User-A
22:08:25.104 -> [EWS] handleClient: Don't keepCurrentClient
22:08:25.104 -> [EWS] handleClient: New Client
22:08:25.139 -> [EWS] _parseRequest: Invalid request:  Accept
22:08:25.139 -> [EWS] handleClient: Don't keepCurrentClient
22:08:25.139 -> [EWS] handleClient: New Client
22:08:25.171 -> [EWS] _parseRequest: Invalid request:  Accept
22:08:25.171 -> [EWS] handleClient: Don't keepCurrentClient
22:08:25.171 -> [EWS] handleClient: New Client
22:08:25.171 -> [EWS] _parseRequest: Invalid request:  Accept
22:08:25.171 -> [EWS] handleClient: Don't keepCurrentClient
22:08:25.171 -> [EWS] handleClient: New Client
22:08:25.205 -> [EWS] _parseRequest: Invalid request:  Cookie
22:08:25.205 -> [EWS] handleClient: Don't keepCurrentClient
22:08:25.205 -> [EWS] handleClient: New Client
22:08:25.205 -> [EWS] _parseRequest: Invalid request:  
22:08:25.205 -> [EWS] handleClient: Don't keepCurrentClient
22:09:28.215 -> [EWS] handleClient: New Client
22:09:28.215 -> [EWS] _parseRequest: Invalid request:  GET /l
22:09:28.248 -> [EWS] handleClient: Don't keepCurrentClient
22:09:28.248 -> [EWS] handleClient: New Client
22:09:28.248 -> [EWS] _parseRequest: Invalid request:  Host: 
22:09:28.248 -> [EWS] handleClient: Don't keepCurrentClient
22:09:28.248 -> [EWS] handleClient: New Client
22:09:28.248 -> [EWS] _parseRequest: Invalid request:  Connec
22:09:28.248 -> [EWS] handleClient: Don't keepCurrentClient
22:09:28.248 -> [EWS] handleClient: New Client
22:09:28.282 -> [EWS] _parseRequest: Invalid request:  Cache-
22:09:28.282 -> [EWS] handleClient: Don't keepCurrentClient
22:09:28.282 -> [EWS] handleClient: New Client
22:09:28.282 -> [EWS] _parseRequest: Invalid request:  Upgrad
22:09:28.282 -> [EWS] handleClient: Don't keepCurrentClient
22:09:28.282 -> [EWS] handleClient: New Client
22:09:28.316 -> [EWS] _parseRequest: Invalid request:  User-A
22:09:28.350 -> [EWS] handleClient: Don't keepCurrentClient
22:09:28.350 -> [EWS] handleClient: New Client
22:09:28.384 -> [EWS] _parseRequest: Invalid request:  Accept
22:09:28.384 -> [EWS] handleClient: Don't keepCurrentClient
22:09:28.384 -> [EWS] handleClient: New Client
22:09:28.384 -> [EWS] _parseRequest: Invalid request:  Accept
22:09:28.384 -> [EWS] handleClient: Don't keepCurrentClient
22:09:28.418 -> [EWS] handleClient: New Client
22:09:28.418 -> [EWS] _parseRequest: Invalid request:  Accept
22:09:28.418 -> [EWS] handleClient: Don't keepCurrentClient
22:09:28.418 -> [EWS] handleClient: New Client
22:09:28.418 -> [EWS] _parseRequest: Invalid request:  Cookie
22:09:28.418 -> [EWS] handleClient: Don't keepCurrentClient
22:09:28.452 -> [EWS] handleClient: New Client
22:09:28.452 -> [EWS] _parseRequest: Invalid request:  
22:09:28.452 -> [EWS] handleClient: Don't keepCurrentClient
22:09:32.143 -> [EWS] handleClient: New Client
22:09:32.143 -> [EWS] _parseRequest: Invalid request:  GET /l
22:09:32.143 -> [EWS] handleClient: Don't keepCurrentClient
22:09:32.143 -> [EWS] handleClient: New Client
22:09:32.143 -> [EWS] _parseRequest: Invalid request:  Host: 
22:09:32.177 -> [EWS] handleClient: Don't keepCurrentClient
22:09:32.177 -> [EWS] handleClient: New Client
22:09:32.177 -> [EWS] _parseRequest: Invalid request:  Connec
22:09:32.177 -> [EWS] handleClient: Don't keepCurrentClient
22:09:32.177 -> [EWS] handleClient: New Client
22:09:32.177 -> [EWS] _parseRequest: Invalid request:  Cache-
22:09:32.177 -> [EWS] handleClient: Don't keepCurrentClient
22:09:32.177 -> [EWS] handleClient: New Client
22:09:32.211 -> [EWS] _parseRequest: Invalid request:  Upgrad
22:09:32.211 -> [EWS] handleClient: Don't keepCurrentClient
22:09:32.211 -> [EWS] handleClient: New Client
22:09:32.245 -> [EWS] _parseRequest: Invalid request:  User-A
22:09:32.245 -> [EWS] handleClient: Don't keepCurrentClient
22:09:32.245 -> [EWS] handleClient: New Client

Help with the ESP32

Hi there,
I have to admit that in using this library I am completely lost.

I have a m5STack with an ethernet unit (ESP32 & W5500) and cannot compile any of the demos.
Because I don't know how and where to define my hardware.

If there is a ready-made demo code for ESP32 and W5500 Ethernet Shield, I will be very happy.

Thanks,
Armin

ESP32 with ENC28j60 slow simple HTTP post request

Slow HTTP POST request on ENC28j60 with ESP32

ESP32 as web client using enc28j60 to post request on local server working very slow around >2200ms.
same request from POSTMAN application takes only 100ms.

Steps to Reproduce

Using generic simple http post example.

Expected behavior

Post request supposed to be completed within <200 ms.

Actual behavior

>2200 ms is consumed by httpclient post request.

Information

Please ensure to specify the following:

  • Platform.io version Core 5.1.1·Home 3.3.4
  • ESP32 ESP32 v3.2.0
  • Contextual information (e.g. what you were trying to achieve) : fast http post request.
  • Anything that might be relevant in your opinion, such as:
    • Operating system windows 10
    • Network configuration wifi

ARDUINO IDE 1.6.12 compile error with esp8266

Arduino IDE version: 1.6.12
ESP32 Core Version 1.0.5
Windows 10

Compile error with esp8266

In file included from D:\Google\DUNYA\WORKS\arduino-1.6.12\libraries\EthernetWebServer\examples\AdvancedWebServer\AdvancedWebServer.ino:44:0:

C:\Users\nrf\AppData\Local\Temp\arduino_build_994772\sketch\defines.h:375:33: fatal error: EthernetLarge.h: No such file or directory#

#include "EthernetLarge.h"

compilation terminated.

RP2040 (IP Unset) with localIP

Hi

I am running the UdpSendReceive with a RP2040 (Earle Philhower port) and a W5500 Ethernet Shield
This is what I get when running the code

Start UDPSendReceive on RASPBERRY_PI_PICO with W5x00 using Ethernet_Generic Library on SPI0/SPI
EthernetWebServer v2.2.3
[EWS] =========== USE_ETHERNET_GENERIC ===========
[EWS] Default SPI pinout:
[EWS] MOSI: 19
[EWS] MISO: 16
[EWS] SCK: 18
[EWS] SS: 17
[EWS] =========================
[EWS] RPIPICO setCsPin: 17
[ETG] W5100 init, using W5100Class::ss_pin =  17 , whereas new ss_pin =  10 , SS_PIN_DEFAULT = 17
[ETG] Chip is W5500
[ETG] W5100::init: W5500, SSIZE = 8192
[EWS] =========================
[EWS] Currently Used SPI pinout:
[EWS] MOSI: 19
[EWS] MISO: 16
[EWS] SCK: 18
[EWS] SS: 17
[EWS] =========================
Using mac index = 17
Connected! IP address: (IP unset)

Starting connection to server...
Listening on port 1883`

Why do I have this (IP unset) for the localIP ?
The Ethernet shield seems to be correctly connected.

Teensy 4.1 : Equivalent for "server.on"

A very nice and complete webserver example has been posted by David Bird at:

https://github.com/G6EJD/ESP-SMART-Thermostat

I am trying to convert that example to use your library with a Teensy 4.1 but getting a compile error for

server.on("/", HTTP_GET, [](AsyncWebServerRequest * request) {

Is there an equivalent to that statement?

Thank you.

Problem with page larger than 2k.

Hello, I don't know exactly where the problem is, but if I try to create an html page larger than 2k, a part of the page will load in the browser (corresponds to a size of about 2k) and then restart for an internal error. I use W5500 (ethernet3), esp8266 (sdk 2.7.1), ethernetwebserver (v 1.0.7).

`void handleRoot()
{
char temp[3000];
uptime::calculateUptime();
float x1 = newVoltageSend;
int x2 = uptime::getDays();
int x3 = uptime::getHours();
int x4 = uptime::getMinutes();
int x5 = uptime::getSeconds();

snprintf(temp, 3000,
"\

<title>ESP8266 WebMonitor - Status info</title>\ <style>body{text-align:center;}table.redTable{font-family:Arial,Helvetica,sans-serif;border:2px solid #A40808;background-color:#EEE7DB;width:330px;height:250px;text-align:center;border-collapse:collapse;margin-left:auto;margin-right:auto;}\ table.redTable td,table.redTable th{border:1px solid #AAAAAA;padding:3px 2px;}\ table.redTable tbody td{font-size:15px;font-weight:bold;}\ table.redTable tr:nth-child(even){background:#F5E1E0;}\ ....... Resend\ Reboot\ Upgrade\\ ", x1, x2, x3, x4, x5); server.send(200, "text/html", temp); }`

.

I initialize ethernet according to the procedure from the example to the size 4k, I also tried a bigger one.
// Use MAX_SOCK_NUM = 4 for 4K, 2 for 8K, 1 for 16K RX/TX buffer
#define ETHERNET3_MAX_SOCK_NUM 4
Ethernet.init (ETHERNET3_MAX_SOCK_NUM);
Ethernet.begin(eeprom_config.mac, ip, subnet, gateway, dns_server);

I don't know where I can make a mistake, can you help me how to send a larger page as 2k.
Thank you

PS: unfortunately the html code does not display correctly here, but it is valid.

Server never returns after "Submit"

The attached code was working fine but is not working on the Teensy 4.1

It is a simple webserver which responds with a Table and a Submit button.

When the website is accessed, everything looks good. However, when I press the submit button, I noticed that the request never finishes on the Teensy side (suddenly stops) and the micro just hangs.

That same code worked before fine ...

webServer2.txt

Too big for UNO R3?

Just to confirm: UNO R3 is not supported, right? I have the Ethernet shield but I get this:

Sketch uses 35252 bytes (109%) of program storage space. Maximum is 32256 bytes.
Global variables use 2658 bytes (129%) of dynamic memory, leaving -610 bytes for local variables. Maximum is 2048 bytes.
Sketch too big; see http://www.arduino.cc/en/Guide/Troubleshooting#size for tips on reducing it.
text section exceeds available space in board
Error compiling for board Arduino Uno.

Ethernet_Large + Lib Patches give always IP:255.255.255.255 || can not server.streamFile () from SPIFFS

Hello,
I'm trying to set up a web server with a W5500 Shield (and a m5Stack).
Since I use Bootstrap and the files are> 40 kB (up to 200 kB) I used the Ethernet_Large Library.
Without your lib patches, the html part loads, but the ESP crashes with the large css + js files.
When I import your lib patches, I only get IP: 255.255.255.255 addresses, regardless of whether I choose static or dynamic. (If I use the original Ethernet_large sources again, I get the correct IP address)

Unfortunately loading SPIFFS doesn't work with your library:

  File file = SPIFFS.open ("/bootstrap.min.css.gz", "r");
  size_t sent = server.streamFile (file, "text/css");

so I added another library:
Effortless_SPIFFS.h https://github.com/thebigpotatoe/Effortless-SPIFFS
This loads the files stored in SPIFFS into a string at lightning speed, which I then transfer to your lib:
Unfortunately the Effortless_SPIFFS doesn't load and extract .gz files (which will server.streamFile() do and server.send() not, I presume ), so I have to use the uncompressed ones ...

bool handleFileRead (String path) {
  String sHTML;
  char cPath [20];
  if (path.endsWith ("/")) path + = "index.html";
  if (SPIFFS.exists (path)) {
    path.toCharArray (cPath, 20);
    String contentType = getContentType (path);
    fileSystem.openFromFile (cPath, sHTML); // <- Effortless_SPIFFS.h
    server.send(200, contentType, sHTML);
    return true;
  }
  return false;
}

Is it possible, to load Files large than >40 kb from SPIFFS and send it to server() - directly with Ethernet_Large, and server.streamFile() or with server.send() ?

Thank you verry much,,
Armin

Upload speed it's slow

Hi,
I'm very happy with your library, so far; just one issue: uploadinglarge files it's very slow.
For example a 170KB file it's taking around 30 seconds to upload it.
I'm using ESP32 + WIZ5500 shield on a SPI bus.
I've changed the HTTP_UPLOAD_BUFLEN to 4K and 16K, no visible change on upload speed.
Downloading the file, it's way more faster (around 1 second).
Thank you,
Alex

Error on PlatformIO "multiple definition of `EthernetWebServer::.."

Hello,

Due to the way the code is written, #include <EthernetWebServer.h> can never be used in a header file.

It always results in a multiple definition error.

I believe the problem can be traced to these two lines in "EthernetWebServer.h"

#include "EthernetWebServer-impl.h"
#include "Parsing-impl.h"

It may be better to convert the "*-impl.h" files to instead be ".cpp" files, which are linked at compile time.

Support for STM32F Series

Hi,

Your README says that From v1.0.2+, the library supports ... STM32F series .... But when I attempt to compile the PostServer example for an STM32F103, I get

WARNING: library functional-vlpp claims to run on avr architecture(s) and may be incompatible with your current board which runs on STM32F1 architecture(s).

and subsequent complaints that PGM_VOID_P and memccpy_P aren't defined

Can you please confirm what STM32F boards are supported and/or if there are any simple defines I need to change to use the STM32F103

Cheers

Andy

Arduino IDE version: 1.8.12

Not Working With Default ETH Library

I am trying to use this webserver with the default ETH library for ethernet. The board is the OMILEX ESP32-GATEWAY, which works with the ETH library by default. Currently the Ethernet initializes and works (it is able to receive pings from other devices), but it does not receive web requests (connection refused).

Is there something with the pin mapping that needs to be done to make this work?

#include <ETH.h>
#include <EthernetWebServer.h>
EthernetWebServer ethernetServer(80);

void handleEthernetRoot(){
    ethernetServer.send(200, "text/plain", "Hello from ESP32 Ethernet!");
}

void setup()
{
  Serial.begin(115200);
  ETH.begin();
  ethernetServer.on("/", handleEthernetRoot);
  ethernetServer.begin();
}

void loop()
{
      ethernetServer.handleClient();
}

fatal error: functional-vlpp.h: No such file or directory

In Arduino IDE 1.8.19
with E. Philhower RP2040 core (what woorks in other cases very well)
I tried to use your example

AdvancedWebServer_RP2040_SPI1.ino

with a "WIZnet 5100S-EVB-Pico" board, that woorks fine with the lib "https://github.com/WIZnet-ArduinoEthernet/Ethernet"
I replaced this lib with your lib.

in your original Exaple AdvancedWebServer_RP2040_SPI1,
I made the following mutations
in the defines.h :

#define USING_SPI2 false // true //muths
IPAddress ip(192, 168, 1, 179); //muths

At the Verify process the have this error msg:

In file included from D:\projekte\RP2040\sketchbook\libraries\EthernetWebServer\src/EthernetWebServer.h:72,
                 from D:\projekte\RP2040\sketchbook\AdvancedWebServer_WIZnetHS1\defines.h:118,
                 from D:\projekte\RP2040\sketchbook\AdvancedWebServer_WIZnetHS1\AdvancedWebServer_WIZnetHS1.ino:44:
D:\projekte\RP2040\sketchbook\libraries\EthernetWebServer\src/EthernetWebServer.hpp:45:10: fatal error: functional-vlpp.h: No such file or directory
   45 | #include <functional-vlpp.h>
      |          ^~~~~~~~~~~~~~~~~~~
compilation terminated.

I couldn't find this file anywhere....

Thanks!

multiple definition of base64 error with ver. 1.8.3

Hi,
After upgrading to version 1.8.3, the following error is observed during compilation

multiple definition of base64_init_encodestate
multiple definition of base64_encode_value
multiple definition of base64_encode_block
multiple definition of base64_encode_blockend
multiple definition of base64_encode_chars

I am using ESP-12E with ENC28J60 Ethernet module and Arduino IDE version 1.8.16 with ESP8266 core 3.0.2

Use the EthernetWebserver and ESP8266Webserver simultaneously

I want to use wifi capability of the esp8266 and connect a Ethernet module(W5500) to have LAN.

I want to connect to different network but serve the same webserver.

So that when I access the ethernet IP and Wifi IP it will show the same webserver.

Dependencies in library.json

Why is the functional library not listed in library.json under dependencies so that PlatformIO can install it automatically?

Missing ESP definitions .....

Hi @khoih-prog
After version 1.8.5, there is no ESP definition in EthernetWebServer.h

EthernetWebServer.h:105:4: error: #error Not supported board. Please check your Tools->Board setting

I am using ESP-12E with ENC28J60 Ethernet module and Arduino IDE version 1.8.16 with ESP8266 core 3.0.2

ESP32 and W5100 help

Hi,

I recently came across your library and was breaking my head to try and integrate a w5100 ethernet shield and ESP32. I have a project where i need to use ethernet when the setting is enabled via an app. I wanted to integrate the ethernet shield ( Which works with my Arduino Mega).

I am unable to go past the Ethernet.Begin(). The Example I'm using is WebClientRepeating.ino .
I am working on PlatformIO core 5.1.1.

I replaced my platformio.ini file with the one provided.

The following changes were made:

    default_envs = esp32
    framework = arduino
    lib_deps= 
            khoih-prog/EthernetWebServer@^1.3.1   
            khoih-prog/Functional-Vlpp@~1.0.2
            PaulStoffregen/Ethernet@~2.0.0
            PaulStoffregen/EthernetLarge@~2.0.0
            adafruit/Ethernet2@~1.0.4
            sstaub/Ethernet3@~1.5.3
            jandrassy/EthernetENC@~2.0.1
           UIPEthernet/UIPEthernet@~2.0.9

PS: PlatformIO couldnt download the following
Library Manager: Installing PaulStoffregen/EthernetLarge @ ~2.0.0
Warning! Could not find the package with 'PaulStoffregen/EthernetLarge @ ~2.0.0' requirements for your system 'windows_amd64'
Library Manager: Installing UIPEthernet/UIPEthernet @ ~2.0.9
Warning! Could not find the package with 'UIPEthernet/UIPEthernet @ ~2.0.9' requirements for your system 'windows_amd64'

Next I went about replacing the files from the LibraryPatches folder. I replaced Ethernet,Ethernet2&3 and EthernetLarge.

Next I opened Server.h and replaced the contents of Server.h with the included Server.h file inside LibraryPatches/esp32/Server.h

Next I copied the code from the Example: WebClientRepeating.ino to my Main.cpp and copied the defines.h inside my src folder. My folder structure is as follows:

Src/
main.cpp
defines.h

The code gets compiled and uploads successfully.

Where I open my Serial Monitor:

clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
mode:DIO, clock div:2   
load:0x3fff0018,len:4   
load:0x3fff001c,len:1044
load:0x40078000,len:8896
load:0x40080400,len:5828
entry 0x400806ac

Starting WebClientRepeating on ESP32 with W5x00 using Ethernet Library
EthernetWebServer v1.3.1
[EWS] =========== USE_ETHERNET ===========
[EWS] Default SPI pinout:
[EWS] MOSI: 23
[EWS] MISO: 19
[EWS] SCK: 18
[EWS] SS: 5
[EWS] =========================
[EWS] ESP32 setCsPin: 22

after this Nothing happens. Ive tried changing it to pin 5 and still no change. The TX LED on my Ethernet Shield blinks quite frequently.

The Connection between ESP32 and W5100 is as follows:

ESP32 | W5100
23 MOSI 11
22 CS 10
19 MISO 12
18 SCK 13

I tried Interchanging MOSI and MISO ie: 23 to 12 and 19 to 11. That also made no difference.
I tried using the ICSP pins, even that made no difference.

Ive tested the Ethernet Shield with my arduino mega, and the board works fine. So i know the board works.Cannot understand why ESP32 wouldnt work.

Regards

Main.cpp

/****************************************************************************************************************************
  WebClientRepeating.ino - Simple Arduino web server sample for Ethernet shield
  
  EthernetWebServer is a library for the Ethernet shields to run WebServer
  
  Based on and modified from ESP8266 https://github.com/esp8266/Arduino/releases
  Built by Khoi Hoang https://github.com/khoih-prog/EthernetWebServer
  Licensed under MIT license
 *****************************************************************************************************************************/
/*
   The Arduino board communicates with the shield using the SPI bus. This is on digital pins 11, 12, and 13 on the Uno
   and pins 50, 51, and 52 on the Mega. On both boards, pin 10 is used as SS. On the Mega, the hardware SS pin, 53,
   is not used to select the Ethernet controller chip, but it must be kept as an output or the SPI interface won't work.
*/
#include <Arduino.h>
#include "defines.h"

char server[] = "arduino.cc";

unsigned long lastConnectionTime = 0;         // last time you connected to the server, in milliseconds
const unsigned long postingInterval = 10000L; // delay between updates, in milliseconds

// Initialize the Web client object
EthernetClient client;

// this method makes a HTTP connection to the server
void httpRequest()
{
  Serial.println();

  // close any connection before send a new request
  // this will free the socket on the WiFi shield
  client.stop();

  // if there's a successful connection
  if (client.connect(server, 80))
  {
    Serial.println(F("Connecting..."));

    // send the HTTP PUT request
    client.println(F("GET /asciilogo.txt HTTP/1.1"));
    client.println(F("Host: arduino.cc"));
    client.println(F("Connection: close"));
    client.println();

    // note the time that the connection was made
    lastConnectionTime = millis();
  }
  else
  {
    // if you couldn't make a connection
    Serial.println(F("Connection failed"));
  }
}

void setup()
{
  Serial.begin(115200);
  while (!Serial)
    ;

  Serial.print("\nStarting WebClientRepeating on " + String(BOARD_NAME));
  Serial.println(" with " + String(SHIELD_TYPE));
  Serial.println(ETHERNET_WEBSERVER_VERSION);

#if USE_ETHERNET_WRAPPER

  EthernetInit();

#else

#if USE_NATIVE_ETHERNET
  ET_LOGWARN(F("======== USE_NATIVE_ETHERNET ========"));
#elif USE_ETHERNET
  ET_LOGWARN(F("=========== USE_ETHERNET ==========="));
#elif USE_ETHERNET2
  ET_LOGWARN(F("=========== USE_ETHERNET2 ==========="));
#elif USE_ETHERNET3
  ET_LOGWARN(F("=========== USE_ETHERNET3 ==========="));
#elif USE_ETHERNET_LARGE
  ET_LOGWARN(F("=========== USE_ETHERNET_LARGE ==========="));
#elif USE_ETHERNET_ESP8266
  ET_LOGWARN(F("=========== USE_ETHERNET_ESP8266 ==========="));
#elif USE_ETHERNET_ENC
  ET_LOGWARN(F("=========== USE_ETHERNET_ENC ==========="));
#else
  ET_LOGWARN(F("========================="));
#endif

  ET_LOGWARN(F("Default SPI pinout:"));
  ET_LOGWARN1(F("MOSI:"), MOSI);
  ET_LOGWARN1(F("MISO:"), MISO);
  ET_LOGWARN1(F("SCK:"), SCK);
  ET_LOGWARN1(F("SS:"), SS);
  ET_LOGWARN(F("========================="));

#if defined(ESP8266)
// For ESP8266, change for other boards if necessary
#ifndef USE_THIS_SS_PIN
#define USE_THIS_SS_PIN D2 // For ESP8266
#endif

  ET_LOGWARN1(F("ESP8266 setCsPin:"), USE_THIS_SS_PIN);

#if (USE_ETHERNET || USE_ETHERNET_LARGE || USE_ETHERNET2 || USE_ETHERNET_ENC)
  // For ESP8266
  // Pin                D0(GPIO16)    D1(GPIO5)    D2(GPIO4)    D3(GPIO0)    D4(GPIO2)    D8
  // Ethernet           0                 X            X            X            X        0
  // Ethernet2          X                 X            X            X            X        0
  // Ethernet3          X                 X            X            X            X        0
  // EthernetLarge      X                 X            X            X            X        0
  // Ethernet_ESP8266   0                 0            0            0            0        0
  // D2 is safe to used for Ethernet, Ethernet2, Ethernet3, EthernetLarge libs
  // Must use library patch for Ethernet, EthernetLarge libraries
  Ethernet.init(USE_THIS_SS_PIN);

#elif USE_ETHERNET3
// Use  MAX_SOCK_NUM = 4 for 4K, 2 for 8K, 1 for 16K RX/TX buffer
#ifndef ETHERNET3_MAX_SOCK_NUM
#define ETHERNET3_MAX_SOCK_NUM 4
#endif

  Ethernet.setCsPin(USE_THIS_SS_PIN);
  Ethernet.init(ETHERNET3_MAX_SOCK_NUM);

#elif USE_CUSTOM_ETHERNET

  // You have to add initialization for your Custom Ethernet here
  // This is just an example to setCSPin to USE_THIS_SS_PIN, and can be not correct and enough
  Ethernet.init(USE_THIS_SS_PIN);

#endif //( USE_ETHERNET || USE_ETHERNET2 || USE_ETHERNET3 || USE_ETHERNET_LARGE )

#elif defined(ESP32)

  // You can use Ethernet.init(pin) to configure the CS pin
  //Ethernet.init(10);  // Most Arduino shields
  //Ethernet.init(5);   // MKR ETH shield
  //Ethernet.init(0);   // Teensy 2.0
  //Ethernet.init(20);  // Teensy++ 2.0
  //Ethernet.init(15);  // ESP8266 with Adafruit Featherwing Ethernet
  //Ethernet.init(33);  // ESP32 with Adafruit Featherwing Ethernet

#ifndef USE_THIS_SS_PIN
#define USE_THIS_SS_PIN 22 // For ESP32
#endif

  ET_LOGWARN1(F("ESP32 setCsPin:"), USE_THIS_SS_PIN);

// For other boards, to change if necessary
#if (USE_ETHERNET || USE_ETHERNET_LARGE || USE_ETHERNET2 || USE_ETHERNET_ENC)
  // Must use library patch for Ethernet, EthernetLarge libraries
  // ESP32 => GPIO2,4,5,13,15,21,22 OK with Ethernet, Ethernet2, EthernetLarge
  // ESP32 => GPIO2,4,5,15,21,22 OK with Ethernet3
  Serial.println("Setting Init to 5");
  //Ethernet.setCsPin (USE_THIS_SS_PIN);
  Ethernet.init(USE_THIS_SS_PIN);

#elif USE_ETHERNET3
// Use  MAX_SOCK_NUM = 4 for 4K, 2 for 8K, 1 for 16K RX/TX buffer
#ifndef ETHERNET3_MAX_SOCK_NUM
#define ETHERNET3_MAX_SOCK_NUM 4
#endif

  Ethernet.setCsPin(USE_THIS_SS_PIN);
  Ethernet.init(ETHERNET3_MAX_SOCK_NUM);

#elif USE_CUSTOM_ETHERNET

  // You have to add initialization for your Custom Ethernet here
  // This is just an example to setCSPin to USE_THIS_SS_PIN, and can be not correct and enough
  Ethernet.init(USE_THIS_SS_PIN);

#endif //( USE_ETHERNET || USE_ETHERNET2 || USE_ETHERNET3 || USE_ETHERNET_LARGE )

#else //defined(ESP8266)
// unknown board, do nothing, use default SS = 10
#ifndef USE_THIS_SS_PIN
#define USE_THIS_SS_PIN 10 // For other boards
#endif

#if defined(BOARD_NAME)
  ET_LOGWARN3(F("Board :"), BOARD_NAME, F(", setCsPin:"), USE_THIS_SS_PIN);
#else
  ET_LOGWARN1(F("Unknown board setCsPin:"), USE_THIS_SS_PIN);
#endif

// For other boards, to change if necessary
#if (USE_ETHERNET || USE_ETHERNET_LARGE || USE_ETHERNET2 || USE_ETHERNET_ENC || USE_NATIVE_ETHERNET)
  // Must use library patch for Ethernet, Ethernet2, EthernetLarge libraries

  Ethernet.init(USE_THIS_SS_PIN);

#elif USE_ETHERNET3
// Use  MAX_SOCK_NUM = 4 for 4K, 2 for 8K, 1 for 16K RX/TX buffer
#ifndef ETHERNET3_MAX_SOCK_NUM
#define ETHERNET3_MAX_SOCK_NUM 4
#endif

  Ethernet.setCsPin(USE_THIS_SS_PIN);
  Ethernet.init(ETHERNET3_MAX_SOCK_NUM);

#elif USE_CUSTOM_ETHERNET

  // You have to add initialization for your Custom Ethernet here
  // This is just an example to setCSPin to USE_THIS_SS_PIN, and can be not correct and enough
  Ethernet.init(USE_THIS_SS_PIN);

#endif //( USE_ETHERNET || USE_ETHERNET2 || USE_ETHERNET3 || USE_ETHERNET_LARGE )

#endif //defined(ESP8266)

#endif //USE_ETHERNET_WRAPPER

  // start the ethernet connection and the server:
  // Use DHCP dynamic IP and random mac
  uint16_t index = millis() % NUMBER_OF_MAC;
  // Use Static IP
  //Ethernet.begin(mac[index], ip);
  Serial.println("Ethernet.Begin()");
  Ethernet.begin(mac[index]);

  // Just info to know how to connect correctly
  Serial.println(F("========================="));
  Serial.println(F("Currently Used SPI pinout:"));
  Serial.print(F("MOSI:"));
  Serial.println(MOSI);
  Serial.print(F("MISO:"));
  Serial.println(MISO);
  Serial.print(F("SCK:"));
  Serial.println(SCK);
  Serial.print(F("SS:"));
  Serial.println(SS);
#if USE_ETHERNET3
  Serial.print(F("SPI_CS:"));
  Serial.println(SPI_CS);
#endif
  Serial.println(F("========================="));

  Serial.print(F("Using mac index = "));
  Serial.println(index);

  Serial.print(F("Connected! IP address: "));
  Serial.println(Ethernet.localIP());
}

void loop()
{
  // if there's incoming data from the net connection send it out the serial port
  // this is for debugging purposes only
  while (client.available())
  {
    char c = client.read();
    Serial.write(c);
    Serial.flush();
  }

  // if 10 seconds have passed since your last connection,
  // then connect again and send data
  if (millis() - lastConnectionTime > postingInterval)
  {
    httpRequest();
  }
}

defines.h

/****************************************************************************************************************************
  defines.h
  EthernetWebServer is a library for the Ethernet shields to run WebServer
  
  Based on and modified from ESP8266 https://github.com/esp8266/Arduino/releases
  Built by Khoi Hoang https://github.com/khoih-prog/EthernetWebServer
  Licensed under MIT license
 ***************************************************************************************************************************************/

#ifndef defines_h
#define defines_h

#define DEBUG_ETHERNET_WEBSERVER_PORT       Serial

// Debug Level from 0 to 4
#define _ETHERNET_WEBSERVER_LOGLEVEL_       3

#if    ( defined(ARDUINO_SAMD_ZERO) || defined(ARDUINO_SAMD_MKR1000) || defined(ARDUINO_SAMD_MKRWIFI1010) \
      || defined(ARDUINO_SAMD_NANO_33_IOT) || defined(ARDUINO_SAMD_MKRFox1200) || defined(ARDUINO_SAMD_MKRWAN1300) || defined(ARDUINO_SAMD_MKRWAN1310) \
      || defined(ARDUINO_SAMD_MKRGSM1400) || defined(ARDUINO_SAMD_MKRNB1500) || defined(ARDUINO_SAMD_MKRVIDOR4000) || defined(__SAMD21G18A__) \
      || defined(ARDUINO_SAMD_CIRCUITPLAYGROUND_EXPRESS) || defined(__SAMD21E18A__) || defined(__SAMD51__) || defined(__SAMD51J20A__) || defined(__SAMD51J19A__) \
      || defined(__SAMD51G19A__) || defined(__SAMD51P19A__) || defined(__SAMD21G18A__) )
  #if defined(ETHERNET_USE_SAMD)
    #undef ETHERNET_USE_SAMD
  #endif
  #define ETHERNET_USE_SAMD      true
  #endif

#if ( defined(NRF52840_FEATHER) || defined(NRF52832_FEATHER) || defined(NRF52_SERIES) || defined(ARDUINO_NRF52_ADAFRUIT) || \
        defined(NRF52840_FEATHER_SENSE) || defined(NRF52840_ITSYBITSY) || defined(NRF52840_CIRCUITPLAY) || defined(NRF52840_CLUE) || \
        defined(NRF52840_METRO) || defined(NRF52840_PCA10056) || defined(PARTICLE_XENON) || defined(NINA_B302_ublox) || defined(NINA_B112_ublox) )
  #if defined(ETHERNET_USE_NRF528XX)
    #undef ETHERNET_USE_NRF528XX
  #endif
  #define ETHERNET_USE_NRF528XX      true
#endif

#if ( defined(ARDUINO_SAM_DUE) || defined(__SAM3X8E__) )
  #if defined(ETHERNET_USE_SAM_DUE)
    #undef ETHERNET_USE_SAM_DUE
  #endif
  #define ETHERNET_USE_SAM_DUE      true
#endif

#if defined(ETHERNET_USE_SAMD)
  // For SAMD
  // Default pin 10 to SS/CS
  #define USE_THIS_SS_PIN       10
  
  #if ( defined(ARDUINO_SAMD_ZERO) && !defined(SEEED_XIAO_M0) )
    #define BOARD_TYPE      "SAMD Zero"
  #elif defined(ARDUINO_SAMD_MKR1000)
    #define BOARD_TYPE      "SAMD MKR1000"
  #elif defined(ARDUINO_SAMD_MKRWIFI1010)
    #define BOARD_TYPE      "SAMD MKRWIFI1010"
  #elif defined(ARDUINO_SAMD_NANO_33_IOT)
    #define BOARD_TYPE      "SAMD NANO_33_IOT"
  #elif defined(ARDUINO_SAMD_MKRFox1200)
    #define BOARD_TYPE      "SAMD MKRFox1200"
  #elif ( defined(ARDUINO_SAMD_MKRWAN1300) || defined(ARDUINO_SAMD_MKRWAN1310) )
    #define BOARD_TYPE      "SAMD MKRWAN13X0"
  #elif defined(ARDUINO_SAMD_MKRGSM1400)
    #define BOARD_TYPE      "SAMD MKRGSM1400"
  #elif defined(ARDUINO_SAMD_MKRNB1500)
    #define BOARD_TYPE      "SAMD MKRNB1500"
  #elif defined(ARDUINO_SAMD_MKRVIDOR4000)
    #define BOARD_TYPE      "SAMD MKRVIDOR4000"
  #elif defined(ARDUINO_SAMD_CIRCUITPLAYGROUND_EXPRESS)
    #define BOARD_TYPE      "SAMD ARDUINO_SAMD_CIRCUITPLAYGROUND_EXPRESS"
  #elif defined(ADAFRUIT_FEATHER_M0_EXPRESS)
    #define BOARD_TYPE      "SAMD21 ADAFRUIT_FEATHER_M0_EXPRESS"
  #elif defined(ADAFRUIT_METRO_M0_EXPRESS)
    #define BOARD_TYPE      "SAMD21 ADAFRUIT_METRO_M0_EXPRESS"
  #elif defined(ADAFRUIT_CIRCUITPLAYGROUND_M0)
    #define BOARD_TYPE      "SAMD21 ADAFRUIT_CIRCUITPLAYGROUND_M0"
  #elif defined(ADAFRUIT_GEMMA_M0)
    #define BOARD_TYPE      "SAMD21 ADAFRUIT_GEMMA_M0"
  #elif defined(ADAFRUIT_TRINKET_M0)
    #define BOARD_TYPE      "SAMD21 ADAFRUIT_TRINKET_M0"
  #elif defined(ADAFRUIT_ITSYBITSY_M0)
    #define BOARD_TYPE      "SAMD21 ADAFRUIT_ITSYBITSY_M0"
  #elif defined(ARDUINO_SAMD_HALLOWING_M0)
    #define BOARD_TYPE      "SAMD21 ARDUINO_SAMD_HALLOWING_M0"
  #elif defined(ADAFRUIT_METRO_M4_EXPRESS)
    #define BOARD_TYPE      "SAMD51 ADAFRUIT_METRO_M4_EXPRESS"
  #elif defined(ADAFRUIT_GRAND_CENTRAL_M4)
    #define BOARD_TYPE      "SAMD51 ADAFRUIT_GRAND_CENTRAL_M4"
  #elif defined(ADAFRUIT_FEATHER_M4_EXPRESS)
    #define BOARD_TYPE      "SAMD51 ADAFRUIT_FEATHER_M4_EXPRESS"
  #elif defined(ADAFRUIT_ITSYBITSY_M4_EXPRESS)
    #define BOARD_TYPE      "SAMD51 ADAFRUIT_ITSYBITSY_M4_EXPRESS"
    #define USE_THIS_SS_PIN       10
  #elif defined(ADAFRUIT_TRELLIS_M4_EXPRESS)
    #define BOARD_TYPE      "SAMD51 ADAFRUIT_TRELLIS_M4_EXPRESS"
  #elif defined(ADAFRUIT_PYPORTAL)
    #define BOARD_TYPE      "SAMD51 ADAFRUIT_PYPORTAL"
  #elif defined(ADAFRUIT_PYPORTAL_M4_TITANO)
    #define BOARD_TYPE      "SAMD51 ADAFRUIT_PYPORTAL_M4_TITANO"
  #elif defined(ADAFRUIT_PYBADGE_M4_EXPRESS)
    #define BOARD_TYPE      "SAMD51 ADAFRUIT_PYBADGE_M4_EXPRESS"
  #elif defined(ADAFRUIT_METRO_M4_AIRLIFT_LITE)
    #define BOARD_TYPE      "SAMD51 ADAFRUIT_METRO_M4_AIRLIFT_LITE"
  #elif defined(ADAFRUIT_PYGAMER_M4_EXPRESS)
    #define BOARD_TYPE      "SAMD51 ADAFRUIT_PYGAMER_M4_EXPRESS"
  #elif defined(ADAFRUIT_PYGAMER_ADVANCE_M4_EXPRESS)
    #define BOARD_TYPE      "SAMD51 ADAFRUIT_PYGAMER_ADVANCE_M4_EXPRESS"
  #elif defined(ADAFRUIT_PYBADGE_AIRLIFT_M4)
    #define BOARD_TYPE      "SAMD51 ADAFRUIT_PYBADGE_AIRLIFT_M4"
  #elif defined(ADAFRUIT_MONSTER_M4SK_EXPRESS)
    #define BOARD_TYPE      "SAMD51 ADAFRUIT_MONSTER_M4SK_EXPRESS"
  #elif defined(ADAFRUIT_HALLOWING_M4_EXPRESS)
    #define BOARD_TYPE      "SAMD51 ADAFRUIT_HALLOWING_M4_EXPRESS"
  #elif defined(SEEED_WIO_TERMINAL)
    #define BOARD_TYPE      "SAMD SEEED_WIO_TERMINAL"
  #elif defined(SEEED_FEMTO_M0)
    #define BOARD_TYPE      "SAMD SEEED_FEMTO_M0"
  #elif defined(SEEED_XIAO_M0)
    #define BOARD_TYPE      "SAMD SEEED_XIAO_M0"
    #ifdef USE_THIS_SS_PIN
      #undef USE_THIS_SS_PIN
    #endif
    #define USE_THIS_SS_PIN       A1
    #warning define SEEED_XIAO_M0 USE_THIS_SS_PIN == A1
  #elif defined(Wio_Lite_MG126)
    #define BOARD_TYPE      "SAMD SEEED Wio_Lite_MG126"
  #elif defined(WIO_GPS_BOARD)
    #define BOARD_TYPE      "SAMD SEEED WIO_GPS_BOARD"
  #elif defined(SEEEDUINO_ZERO)
    #define BOARD_TYPE      "SAMD SEEEDUINO_ZERO"
  #elif defined(SEEEDUINO_LORAWAN)
    #define BOARD_TYPE      "SAMD SEEEDUINO_LORAWAN"
  #elif defined(SEEED_GROVE_UI_WIRELESS)
    #define BOARD_TYPE      "SAMD SEEED_GROVE_UI_WIRELESS"
  #elif defined(__SAMD21E18A__)
    #define BOARD_TYPE      "SAMD21E18A"
  #elif defined(__SAMD21G18A__)
    #define BOARD_TYPE      "SAMD21G18A"
  #elif defined(__SAMD51G19A__)
    #define BOARD_TYPE      "SAMD51G19A"
  #elif defined(__SAMD51J19A__)
    #define BOARD_TYPE      "SAMD51J19A"
  #elif defined(__SAMD51J20A__)
    #define BOARD_TYPE      "SAMD51J20A"
  #elif defined(__SAM3X8E__)
    #define BOARD_TYPE      "SAM3X8E"
  #elif defined(__CPU_ARC__)
    #define BOARD_TYPE      "CPU_ARC"
  #elif defined(__SAMD51__)
    #define BOARD_TYPE      "SAMD51"
  #else
    #define BOARD_TYPE      "SAMD Unknown"
  #endif

#elif (ETHERNET_USE_SAM_DUE)
  // Default pin 10 to SS/CS
  #define USE_THIS_SS_PIN       10
  #define BOARD_TYPE      "SAM DUE"

#elif (ETHERNET_USE_NRF528XX)
  // Default pin 10 to SS/CS
  #define USE_THIS_SS_PIN       10

  #if defined(NRF52840_FEATHER)
    #define BOARD_TYPE      "NRF52840_FEATHER"
  #elif defined(NRF52832_FEATHER)
    #define BOARD_TYPE      "NRF52832_FEATHER"
  #elif defined(NRF52840_FEATHER_SENSE)
    #define BOARD_TYPE      "NRF52840_FEATHER_SENSE"
  #elif defined(NRF52840_ITSYBITSY)
    #define BOARD_TYPE      "NRF52840_ITSYBITSY"
    #define USE_THIS_SS_PIN   10    // For other boards
  #elif defined(NRF52840_CIRCUITPLAY)
    #define BOARD_TYPE      "NRF52840_CIRCUITPLAY"
  #elif defined(NRF52840_CLUE)
    #define BOARD_TYPE      "NRF52840_CLUE"
  #elif defined(NRF52840_METRO)
    #define BOARD_TYPE      "NRF52840_METRO"
  #elif defined(NRF52840_PCA10056)
    #define BOARD_TYPE      "NRF52840_PCA10056"
  #elif defined(NINA_B302_ublox)
    #define BOARD_TYPE      "NINA_B302_ublox"
  #elif defined(NINA_B112_ublox)
    #define BOARD_TYPE      "NINA_B112_ublox"
  #elif defined(PARTICLE_XENON)
    #define BOARD_TYPE      "PARTICLE_XENON"
  #elif defined(ARDUINO_NRF52_ADAFRUIT)
    #define BOARD_TYPE      "ARDUINO_NRF52_ADAFRUIT"
  #else
    #define BOARD_TYPE      "nRF52 Unknown"
  #endif

#elif ( defined(CORE_TEENSY) )
  // Default pin 10 to SS/CS
  #define USE_THIS_SS_PIN       10
  
  #if defined(__IMXRT1062__)
    // For Teensy 4.1/4.0
    #if defined(ARDUINO_TEENSY41)
      #define BOARD_TYPE      "TEENSY 4.1"
      // Use true for NativeEthernet Library, false if using other Ethernet libraries
      #define USE_NATIVE_ETHERNET     true
    #elif defined(ARDUINO_TEENSY40)
      #define BOARD_TYPE      "TEENSY 4.0"
    #else
      #define BOARD_TYPE      "TEENSY 4.x"
    #endif      
  #elif defined(__MK66FX1M0__)
    #define BOARD_TYPE "Teensy 3.6"
  #elif defined(__MK64FX512__)
    #define BOARD_TYPE "Teensy 3.5"
  #elif defined(__MKL26Z64__)
    #define BOARD_TYPE "Teensy LC"
  #elif defined(__MK20DX256__)
    #define BOARD_TYPE "Teensy 3.2" // and Teensy 3.1 (obsolete)
  #elif defined(__MK20DX128__)
    #define BOARD_TYPE "Teensy 3.0"
  #elif defined(__AVR_AT90USB1286__)
    #error Teensy 2.0++ not supported yet
  #elif defined(__AVR_ATmega32U4__)
    #error Teensy 2.0 not supported yet
  #else
    // For Other Boards
    #define BOARD_TYPE      "Unknown Teensy Board"
  #endif

#elif ( defined(ESP8266) )
  // For ESP8266
  #warning Use ESP8266 architecture
  #include <ESP8266mDNS.h>
  #define ETHERNET_USE_ESP8266
  #define BOARD_TYPE      "ESP8266"

#elif ( defined(ESP32) )
  // For ESP32
  #warning Use ESP32 architecture
  #define ETHERNET_USE_ESP32
  #define BOARD_TYPE      "ESP32"
  
  #define W5500_RST_PORT   21

#else
  // For Mega
  // Default pin 10 to SS/CS
  #define USE_THIS_SS_PIN       10

  // Reduce size for Mega
  #define SENDCONTENT_P_BUFFER_SZ     512
  
  #define BOARD_TYPE            "AVR Mega"
#endif

#ifndef BOARD_NAME
  #define BOARD_NAME    BOARD_TYPE
#endif

#include <SPI.h>

//#define USE_ETHERNET_WRAPPER    true
#define USE_ETHERNET_WRAPPER    false

// Use true  for ENC28J60 and UIPEthernet library (https://github.com/UIPEthernet/UIPEthernet)
// Use false for W5x00 and Ethernetx library      (https://www.arduino.cc/en/Reference/Ethernet)

//#define USE_UIP_ETHERNET   true
#define USE_UIP_ETHERNET   false

// Note: To rename ESP628266 Ethernet lib files to Ethernet_ESP8266.h and Ethernet_ESP8266.cpp
// In order to USE_ETHERNET_ESP8266
#if ( !defined(USE_UIP_ETHERNET) || !USE_UIP_ETHERNET )

  // To override the default CS/SS pin. Don't use unless you know exactly which pin to use
  // You can define here or customize for each board at same place with BOARD_TYPE
  // Check @ defined(SEEED_XIAO_M0)
  //#define USE_THIS_SS_PIN   22  //21  //5 //4 //2 //15
  
  // Only one if the following to be true
  #define USE_ETHERNET          true
  #define USE_ETHERNET2         false
  #define USE_ETHERNET3         false
  #define USE_ETHERNET_LARGE    false
  #define USE_ETHERNET_ESP8266  false 
  #define USE_ETHERNET_ENC      false
  #define USE_CUSTOM_ETHERNET   false
  
  #if !USE_ETHERNET_WRAPPER
  
    #if ( USE_ETHERNET2 || USE_ETHERNET3 || USE_ETHERNET_LARGE || USE_ETHERNET_ESP8266 || USE_ETHERNET_ENC || USE_NATIVE_ETHERNET )
      #ifdef USE_CUSTOM_ETHERNET
        #undef USE_CUSTOM_ETHERNET
      #endif
      #define USE_CUSTOM_ETHERNET   false
    #endif

    #if USE_NATIVE_ETHERNET
      #include "NativeEthernet.h"
      #warning Using NativeEthernet lib for Teensy 4.1. Must also use Teensy Packages Patch or error
      #define SHIELD_TYPE           "Custom Ethernet using Teensy 4.1 NativeEthernet Library"
    #elif USE_ETHERNET3
      #include "Ethernet3.h"
      #warning Using Ethernet3 lib
      #define SHIELD_TYPE           "W5x00 using Ethernet3 Library"
    #elif USE_ETHERNET2
      #include "Ethernet2.h"
      #warning Using Ethernet2 lib
      #define SHIELD_TYPE           "W5x00 using Ethernet2 Library"
    #elif USE_ETHERNET_LARGE
      #include "EthernetLarge.h"
      #warning Using EthernetLarge lib
      #define SHIELD_TYPE           "W5x00 using EthernetLarge Library"
    #elif USE_ETHERNET_ESP8266
      #include "Ethernet_ESP8266.h"
      #warning Using Ethernet_ESP8266 lib 
      #define SHIELD_TYPE           "W5x00 using Ethernet_ESP8266 Library" 
    #elif USE_ETHERNET_ENC
      #include "EthernetENC.h"
      #warning Using EthernetENC lib
      #define SHIELD_TYPE           "ENC28J60 using EthernetENC Library"
    #elif USE_CUSTOM_ETHERNET
      //#include "Ethernet_XYZ.h"
      #include "EthernetENC.h"
      #warning Using Custom Ethernet library. You must include a library and initialize.
      #define SHIELD_TYPE           "Custom Ethernet using Ethernet_XYZ Library"
    #else
      #ifdef USE_ETHERNET
        #undef USE_ETHERNET
      #endif
      #define USE_ETHERNET   true
      #include "Ethernet.h"
      #warning Using Ethernet lib
      #define SHIELD_TYPE           "W5x00 using Ethernet Library"
    #endif
    
    // Ethernet_Shield_W5200, EtherCard, EtherSia not supported
    // Select just 1 of the following #include if uncomment #define USE_CUSTOM_ETHERNET
    // Otherwise, standard Ethernet library will be used for W5x00
  
  #endif    //  USE_ETHERNET_WRAPPER
#elif USE_UIP_ETHERNET
    #include "UIPEthernet.h"
    #warning Using UIPEthernet library
    #define SHIELD_TYPE           "ENC28J60 using UIPEthernet Library"
#endif      // #if !USE_UIP_ETHERNET

#include <EthernetWebServer.h>

#ifndef SHIELD_TYPE
  #define SHIELD_TYPE     "Unknown Ethernet shield/library" 
#endif

// Enter a MAC address and IP address for your controller below.
#define NUMBER_OF_MAC      20

byte mac[][NUMBER_OF_MAC] =
{
  { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0x01 },
  { 0xDE, 0xAD, 0xBE, 0xEF, 0xBE, 0x02 },
  { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0x03 },
  { 0xDE, 0xAD, 0xBE, 0xEF, 0xBE, 0x04 },
  { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0x05 },
  { 0xDE, 0xAD, 0xBE, 0xEF, 0xBE, 0x06 },
  { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0x07 },
  { 0xDE, 0xAD, 0xBE, 0xEF, 0xBE, 0x08 },
  { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0x09 },
  { 0xDE, 0xAD, 0xBE, 0xEF, 0xBE, 0x0A },
  { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0x0B },
  { 0xDE, 0xAD, 0xBE, 0xEF, 0xBE, 0x0C },
  { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0x0D },
  { 0xDE, 0xAD, 0xBE, 0xEF, 0xBE, 0x0E },
  { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0x0F },
  { 0xDE, 0xAD, 0xBE, 0xEF, 0xBE, 0x10 },
  { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0x11 },
  { 0xDE, 0xAD, 0xBE, 0xEF, 0xBE, 0x12 },
  { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0x13 },
  { 0xDE, 0xAD, 0xBE, 0xEF, 0xBE, 0x14 },
};

// Select the IP address according to your local network
IPAddress ip(192, 168, 2, 222);

#endif    //defines_h

Esp32
w5100sheild

AdvancedWebServer example give me wrong ip HTTP EthernetWebServer is @ IP : 0.0.0.0

Describe the bug

I have a new board SAMD21 M0 size as Arduino UNO, compatible with Arduino M0, native port, with ethernet shield Wiznet W5100.
I tried example code Hello World, edit all serial.print to serialUSB.print and load to cpu over Native USB port, I have selected Arduino M0 board in Arduino IDE. Then, I get this from serial monitor:

Starting HelloServer on SAMD Zero with W5x00 using Ethernet_Generic Library on SPI0/SPI
EthernetWebServer v2.2.0
[EWS] =========== USE_ETHERNET_GENERIC ===========
[EWS] Default SPI pinout:
[EWS] MOSI: 23
[EWS] MISO: 22
[EWS] SCK: 24
[EWS] SS: 16
[EWS] =========================
[EWS] Board : SAMD Zero , setCsPin: 10
[EWS] =========================
[EWS] Currently Used SPI pinout:
[EWS] MOSI: 23
[EWS] MISO: 22
[EWS] SCK: 24
[EWS] SS: 16
[EWS] =========================
Using mac index = 12
Connected! IP address: 0.0.0.0

I have a company network on 192.168.0.x with DHCP. Before, this shield I used with MEGA and webduino, working.
Thank you.

Needing help !

I know that it is not an issue related, but I am geting mad trying to use the EthernetWebServer
library together with the https://github.com/Aircoookie/Espalexa.

I did some small changes in the Espalexa library and now it compiles wihthout any error, the espalexa server works, but the alexa never discovers the devices.

I am using the W5500, the TCP server and the webserver work very well and fast, but to finish my project I need that the Espalexa library works with this one.

I know that it is compatible with the LAN8720 module, but I can't see why it is not working with the W5500. I don't know the differences between them, as I am not espacialist. I wish I were !

So, if you could help me to find out what I have to change in the Espalexa for it work I will be vary gratefull.

I can pay for your time if you julge necessary.

Sorry If I annoyed you with my problem, it was not my intent.

Thanks in advance.

Teensy 4.1 server.streamFile not working

  • PlatformIO Core [5.2.5] · Home [3.4.1]
    • Platform: Teensy 4.15.0
  • Builder: Windows 10 21H1
  • EWS 2.1.2

Describe the bug

I try to send a html (actually a whole SPA) from an SD card over ethernet. But streaming files is not working.

Steps to Reproduce

  • Get any SD card.
  • Put a file on it
  • Get your teensy 4.1 PlatformIO and install EthernetWebServer.
  • Apply patches, insert SD Card
  • Init the built-in SD card library SD.begin(BUILTIN_SDCARD); in setup()
  • At any point in request handler function insert:
if (SD.exists(path_to_file.c_str()))
{
    File myFile = SD.open(path_to_file.c_str());
    uint32_t myFileSize = myFile .size();
    Serial.println("SIZE to send: " + String(myFileSize)); // Debug check size
   
    server.streamFile(myFile , getContentType(path_to_file));
    myFile.close();
    return;
 }

Expected behavior

The myFile is send to the client

Actual behavior

The debug check files size output shows correct size of file to send.
The browser fails with net::ERR_CONTENT_LENGTH_MISMATCH 200 (OK)
Reported: File is incomplete (Actually no file is written. I doubt that bytes are sent at all)

Debug and AT-command log (if applicable)

Connected! IP address: 192.168.1.109
[EWS] handleClient: New Client
[EWS] method:  GET
[EWS] url:  /js/61.28ba07b9.js
[EWS] search:
[EWS] headerName: Host
[EWS] headerValue: 192.168.1.109
[EWS] headerName: Connection
[EWS] headerValue: keep-alive
[EWS] headerName: Upgrade-Insecure-Requests
[EWS] headerValue: 1
[EWS] headerName: User-Agent
[EWS] headerValue: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/100.0.4896.88 Safari/537.36
[EWS] headerName: Accept
[EWS] headerValue: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9
[EWS] headerName: Accept-Encoding
[EWS] headerValue: gzip, deflate
[EWS] headerName: Accept-Language
[EWS] headerValue: de-DE,de;q=0.9,en-US;q=0.8,en;q=0.7
[EWS] args:
[EWS] args count:  0
[EWS] args:
[EWS] args count:  0
[EWS] Request: /js/61.28ba07b9.js
[EWS] Arguments:
[EWS] Final list of key/value pairs:
[EWS] _handleRequest: request handler not found
SIZE to send: 1834

[EWS] send1: len =  0
[EWS] content =
[EWS] _prepareHeader response = HTTP/1.1 200 OK

[EWS] _prepareHeader sendHeader Conn close
[EWS] handleClient: Don't keepCurrentClient

Problem with your custom ethernet library (W5500-Teensy 4.0)

Hi! I'm working with your library with a teensy 4.0 and Ethernet Chip W5500. With default Ethernet library, I can't send messages longer than 2K. When I paste your custom files of that library I can't send any messages. "HTTP_MAX_CLOSE_WAIT" Timeout.
Do you have any suggestion of what may be my problem?

WebServer not functioning on Teensy 4.1

Describe the bug

When the advanced functionality of this library is used on a Teensy 4.1, requests are never handled and time out.
It also stops going trough the loop until the request is cancelled.

Steps to Reproduce

  1. Setup EthernetWebServer with advanced functions, like in AWS-example
  2. Run it on a Teensy 4.1
  3. Call the webpage

Expected behavior

Teensy sending "Hello World" as a response.

Actual behavior

The request is never handled by Teensy.

Serial Output

10.0.0.3
..........

Code used for testing

#include <EthernetWebServer.h>
#include <NativeEthernet.h>

#define _ETHERNET_WEBSERVER_LOGLEVEL_ 4
#define USE_NATIVE_ETHERNET true
#define USE_THIS_SS_PIN 10

byte mac[6] = {0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED};

IPAddress ip(10, 0, 0, 3);
IPAddress gateway(10, 0, 0, 1);
IPAddress submask(255, 255, 255, 0);

EthernetWebServer server(80);

void setup()
{
    Serial.begin(115200);
    while (!Serial)
        ;

    Ethernet.init(USE_THIS_SS_PIN);
    Ethernet.begin(mac, ip, gateway, submask);

    Serial.println(Ethernet.localIP());

    server.on("/", []()
              { server.send(200, "text/html", "Hello World"); });

    server.onNotFound([]()
                      { server.send(404, "Content not found"); });

    server.begin();
}
int lastBeat = 0;
void loop()
{
    if (millis() - lastBeat >= 5000)
    {
        Serial.print(".");
        lastBeat = millis();
    }
    server.handleClient();
}

FNET dns-client (on Teensy 4.1) doesn't resolve hostnames of Azure Table Storage accounts

This is not an issue of this library but of the FNET library used by the NativeEthernet library on Teensy 4.1.
I'm just searching for people to take part in the discussion whether this is an issue of the FNET library or not.

butok/FNET#7

https://stackoverflow.com/questions/67421802/should-rfc-conform-dns-clients-resolve-urls-of-azure-table-storage-accounts-whic

On the first I would be happy if someone could confirm that on the Teensy 4.1 FNET doesn't resolve the Ip addresses of CNAME records.
Kind regards
RoSchmi

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.