EthernetWebServer.h keeps crash

Hello everyone,

for a project i am working on i use the EthernetWebServer.h library to upload the code on the ESP32S3 via Ethernet using the W5500.
I used the same code earlier (in 2024 and it worked) but when now i try to compile it i get error messags which i'll post here.
I tried just to open new sketch and include the library (EthernetWebServer.h) but i get the same error.
I have already changed the member function :

virtual void begin( uint13_t port=0) =;

to:

void begin() {};

with no success.
Here is the error:

In file included from h:\Documents\Arduino\libraries\Ethernet_Generic\src/Ethernet_Generic_Impl.h:64,
                 from h:\Documents\Arduino\libraries\Ethernet_Generic\src/Ethernet_Generic.h:85,
                 from h:\Documents\Arduino\libraries\EthernetWebServer\src/EthernetWebServer.h:58,
                 from C:\Users\khalilm\AppData\Local\Temp\.arduinoIDE-unsaved202513-12756-16urj7s.th8k\sketch_feb3a\sketch_feb3a.ino:1:
h:\Documents\Arduino\libraries\Ethernet_Generic\src/EthernetServer_Impl.h:83:16: error: invalid abstract return type for member function 'EthernetClient EthernetServer::available()'
   83 | EthernetClient EthernetServer::available()
      |                ^~~~~~~~~~~~~~
In file included from h:\Documents\Arduino\libraries\Ethernet_Generic\src/Ethernet_Generic.h:84:
h:\Documents\Arduino\libraries\Ethernet_Generic\src/Ethernet_Generic.hpp:462:7: note:   because the following virtual functions are pure within 'EthernetClient':
  462 | class EthernetClient : public Client
      |       ^~~~~~~~~~~~~~
In file included from C:\Users\khalilm\AppData\Local\Arduino15\packages\esp32\hardware\esp32\3.1.0-RC3\cores\esp32/Arduino.h:197,
                 from C:\Users\khalilm\AppData\Local\arduino\sketches\ACE1E3E06AEF3D379195357196C96B8F\sketch\sketch_feb3a.ino.cpp:1:
C:\Users\khalilm\AppData\Local\Arduino15\packages\esp32\hardware\esp32\3.1.0-RC3\cores\esp32/Client.h:29:15: note:     'virtual int Client::connect(IPAddress, uint16_t, int32_t)'
   29 |   virtual int connect(IPAddress ip, uint16_t port, int32_t timeout) = 0;
      |               ^~~~~~~
C:\Users\khalilm\AppData\Local\Arduino15\packages\esp32\hardware\esp32\3.1.0-RC3\cores\esp32/Client.h:31:15: note:     'virtual int Client::connect(const char*, uint16_t, int32_t)'
   31 |   virtual int connect(const char *host, uint16_t port, int32_t timeout) = 0;
      |               ^~~~~~~
h:\Documents\Arduino\libraries\Ethernet_Generic\src/EthernetServer_Impl.h: In member function 'EthernetClient EthernetServer::available()':
h:\Documents\Arduino\libraries\Ethernet_Generic\src/EthernetServer_Impl.h:93:39: error: invalid cast to abstract class type 'EthernetClient'
   93 |     return EthernetClient(MAX_SOCK_NUM);
      |                                       ^
h:\Documents\Arduino\libraries\Ethernet_Generic\src/EthernetServer_Impl.h:138:34: error: invalid cast to abstract class type 'EthernetClient'
  138 |   return EthernetClient(sockindex);
      |                                  ^
h:\Documents\Arduino\libraries\Ethernet_Generic\src/EthernetServer_Impl.h: At global scope:
h:\Documents\Arduino\libraries\Ethernet_Generic\src/EthernetServer_Impl.h:143:16: error: invalid abstract return type for member function 'EthernetClient EthernetServer::accept()'
  143 | EthernetClient EthernetServer::accept()
      |                ^~~~~~~~~~~~~~
h:\Documents\Arduino\libraries\Ethernet_Generic\src/EthernetServer_Impl.h: In member function 'EthernetClient EthernetServer::accept()':
h:\Documents\Arduino\libraries\Ethernet_Generic\src/EthernetServer_Impl.h:153:39: error: invalid cast to abstract class type 'EthernetClient'
  153 |     return EthernetClient(MAX_SOCK_NUM);
      |                                       ^
h:\Documents\Arduino\libraries\Ethernet_Generic\src/EthernetServer_Impl.h:190:34: error: invalid cast to abstract class type 'EthernetClient'
  190 |   return EthernetClient(sockindex);
      |                                  ^
h:\Documents\Arduino\libraries\Ethernet_Generic\src/EthernetServer_Impl.h: In member function 'virtual size_t EthernetServer::write(const uint8_t*, size_t)':
h:\Documents\Arduino\libraries\Ethernet_Generic\src/EthernetServer_Impl.h:409:12: error: cannot allocate an object of abstract type 'EthernetClient'
  409 |   available();
      |   ~~~~~~~~~^~
In file included from h:\Documents\Arduino\libraries\EthernetWebServer\src/EthernetWebServer.h:67:
h:\Documents\Arduino\libraries\EthernetWebServer\src/EthernetWebServer.hpp: At global scope:
h:\Documents\Arduino\libraries\EthernetWebServer\src/EthernetWebServer.hpp:578:23: error: cannot declare field 'EthernetWebServer::_currentClient' to be of abstract type 'EthernetClient'
  578 |     EthernetClient    _currentClient;
      |                       ^~~~~~~~~~~~~~
h:\Documents\Arduino\libraries\EthernetWebServer\src/EthernetWebServer.hpp:376:20: error: invalid abstract return type for member function 'EthernetClient EthernetWebServer::client()'
  376 |     EthernetClient client()
      |                    ^~~~~~
h:\Documents\Arduino\libraries\EthernetWebServer\src/EthernetWebServer.hpp: In member function 'EthernetClient EthernetWebServer::client()':
h:\Documents\Arduino\libraries\EthernetWebServer\src/EthernetWebServer.hpp:378:14: error: cannot allocate an object of abstract type 'EthernetClient'
  378 |       return _currentClient;
      |              ^~~~~~~~~~~~~~
In file included from h:\Documents\Arduino\libraries\EthernetWebServer\src/EthernetWebServer.h:68:
h:\Documents\Arduino\libraries\EthernetWebServer\src/EthernetWebServer-impl.h: In member function 'void EthernetWebServer::handleClient()':
h:\Documents\Arduino\libraries\EthernetWebServer\src/EthernetWebServer-impl.h:243:46: error: cannot allocate an object of abstract type 'EthernetClient'
  243 |     EthernetClient client = _server.available();
      |                             ~~~~~~~~~~~~~~~~~^~
h:\Documents\Arduino\libraries\EthernetWebServer\src/EthernetWebServer-impl.h:243:20: error: cannot declare variable 'client' to be of abstract type 'EthernetClient'
  243 |     EthernetClient client = _server.available();
      |                    ^~~~~~
h:\Documents\Arduino\libraries\EthernetWebServer\src/EthernetWebServer-impl.h:319:37: error: invalid cast to abstract class type 'EthernetClient'
  319 |     _currentClient = EthernetClient();
      |                                     ^
h:\Documents\Arduino\libraries\EthernetWebServer\src/EthernetWebServer-impl.h: In member function 'void EthernetWebServer::serveStatic(const char*, fs::FS&, const char*, const char*)':
h:\Documents\Arduino\libraries\EthernetWebServer\src/EthernetWebServer-impl.h:862:26: error: expected type-specifier before 'StaticFileRequestHandler'
  862 |   _addRequestHandler(new StaticFileRequestHandler(fs, path, uri, cache_header));

So please if someone had encountered such situation and manage to fix it, help me to fix it too.
Thanks in Advance

Any chance that you changed the ESP32 board package from version 2.x to version 3.x? That might (!) be the cause of your problem.

Actually yes, it is now 3.1.1.
Can i downgrade it to 2.x.x?
Should i?

Yes, you can downgrade (using the boards manager). You can always upgrade again.

And now i ran into another problem.
i have uninstalled the 3.x.x but now i am not able to download any board.
Current version is 2.0.6 but it does not include the ESP32S3 which i use.
The error i get when trying to upgrade:

Failed to install platform: 'esp32:2.0.10'. 2 UNKNOWN: Get "https://github.com/espressif/crosstool-NG/releases/download/esp-2021r2-patch5/xtensa-esp32-elf-gcc8_4_0-esp-2021r2-patch5-win64.zip": dial tcp 140.82.121.3:443: connectex: A connection attempt failed because the remote host did not respond properly after a certain period of time, or the established connection was corrupted because the connected host did not respond.

use esp32 platform version 3 with the bundled ETH.h library (or my EthernetESP32 library) with the bundled WebServer library

https://github.com/Networking-for-Arduino/EthernetESP32/blob/master/examples/HelloServer/HelloServer.ino

Does your Ethernet library support OTA update?

Anything special about your network connection? VPN, firewall, corporate network?

Thank you for your replies.
The problem was with the upgraded Board package.
I have downgraded it and it does work now.

the bundled OTA libraries work

https://github.com/Networking-for-Arduino/EthernetESP32/blob/master/examples/BasicOTA/BasicOTA.ino

Thank you,
i will take a look at this Library and try to use it in my project.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.