Skip to content

Update Server.h for arduino core compatibility #3607

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed

Update Server.h for arduino core compatibility #3607

wants to merge 1 commit into from

Conversation

orvisevans
Copy link

https://github.com/arduino/ArduinoCore-API/blob/master/api/Server.h
The ArduinoCore uses virtual void begin() =0; Changing this allowed me to compile a project using the Ethernet library. Otherwise I would get the following compile error:

src\main.cpp:35:16: error: cannot declare variable 'server' to be of abstract type 'EthernetServer'
 EthernetServer server(80);
                ^
In file included from src\main.cpp:21:0:
.pio\libdeps\featheresp32\Ethernet_ID872\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\orvis\.platformio\packages\framework-arduinoespressif32\cores\esp32/Arduino.h:152:0,
                 from .pio\libdeps\featheresp32\Ethernet_ID872\src/Ethernet.h:51,
                 from src\main.cpp:21:
C:\users\orvis\.platformio\packages\framework-arduinoespressif32\cores\esp32/Server.h:28:18: note:      virtual void Server::begin(uint16_t)
     virtual void begin(uint16_t port = 0) = 0;

https://github.com/arduino/ArduinoCore-API/blob/master/api/Server.h
The ArduinoCore uses virtual void begin() =0;  Changing this allowed me to compile a project using the Ethernet library.  Otherwise I would get the following compile error:
src\main.cpp:35:16: error: cannot declare variable 'server' to be of abstract type 'EthernetServer'
 EthernetServer server(80);
                ^
In file included from src\main.cpp:21:0:
.pio\libdeps\featheresp32\Ethernet_ID872\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\orvis\.platformio\packages\framework-arduinoespressif32\cores\esp32/Arduino.h:152:0,
                 from .pio\libdeps\featheresp32\Ethernet_ID872\src/Ethernet.h:51,
                 from src\main.cpp:21:
C:\users\orvis\.platformio\packages\framework-arduinoespressif32\cores\esp32/Server.h:28:18: note:      virtual void Server::begin(uint16_t)
     virtual void begin(uint16_t port = 0) = 0;
@me-no-dev
Copy link
Member

it does break other things though. We will move to the official API soon enough :)

@ivoh95
Copy link

ivoh95 commented Mar 6, 2020

@me-no-dev > it does break other things though. We will move to the official API soon enough :)

For us to move to the official API, what all needs to be changed? I believe this goes deeper into the way wifi as works well and not just Ethernet? What files would need to be changed to move to the official API?

@CircuitSetup
Copy link

Was any progress ever made with this?

@orvisevans
Copy link
Author

Not by me, unfortunately.

@jaap-smd
Copy link

jaap-smd commented Dec 29, 2020

I have the same problem.
I want to use Socket.IO with this websockets library: links2004/WebSockets@^2.3.2 over Ethernet.
After making some minor changes in the websockets library to make it work, I got this error:
lib/WebSockets/src/WebSocketsServer.cpp: In constructor 'WebSocketsServer::WebSocketsServer(uint16_t, const String&, const String&)': lib/WebSockets/src/WebSocketsServer.cpp:49:55: error: invalid new-expression of abstract class type 'EthernetServer' _server = new WEBSOCKETS_NETWORK_SERVER_CLASS(port);
With the comment: WEBSOCKETS_NETWORK_SERVER_CLASS (= ETHERNET) is a pure virtual function.
ETHERNET is derived from server. So when I change in server.h:
virtual void begin(uint16_t port=0) =0;
to
virtual void begin(uint16_t port=0);
the code is working like expected. Well for me at least.
Any chance there will be a fix?

@thujer
Copy link

thujer commented Dec 30, 2020 via email

@thujer
Copy link

thujer commented Jan 5, 2021 via email

@CLAassistant
Copy link

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

@stale
Copy link

stale bot commented Apr 16, 2022

Is this still relevant? If so, what is blocking it? Is there anything you can do to help move it forward?

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.

@github-actions
Copy link
Contributor

Unit Test Results

0 files  0 suites   0s ⏱️
0 tests 0 ✔️ 0 💤 0

Results for commit b5df1fe.

@orvisevans orvisevans closed this Jul 1, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants