Skip to content
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

Server.h not matching Arduino API #2704

Closed
JAndrassy opened this issue Apr 24, 2019 · 10 comments
Closed

Server.h not matching Arduino API #2704

JAndrassy opened this issue Apr 24, 2019 · 10 comments
Labels
Resolution: Duplicate Issue is a duplicate of another issue

Comments

@JAndrassy
Copy link
Contributor

The Arduino Server class has pure virtual begin() without parameters. The esp32 core Server.h has pure virtual begin() with parameter. Arduino networking libraries like Ethernet and UIPEthernet don't compile on esp32 core because they implement begin without parameter as required by Arduino API.

@me-no-dev
Copy link
Member

And your proposal is? We need to define the port for the server. How do those libraries you point to handle that?

@me-no-dev
Copy link
Member

You were presented with an issue template when you clicked New issue. Why is it so hard to fill it in?

@JAndrassy
Copy link
Contributor Author

And your proposal is? We need to define the port for the server. How do those libraries you point to handle that?

port is set with constructor for server in all Arduino networking libraries implementing Client and Server class. here is an answer on how to change the port later.

You were presented with an issue template when you clicked New issue. Why is it so hard to fill it in?

I don't have this problem, I don't use esp32 in a project. I only try to make my libraries compatible with it. I created this issue because I know about this problem a long time and the new release still has it and added one more similar in Client.

@stale
Copy link

stale bot commented Aug 1, 2019

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

@stale stale bot added the Status: Stale Issue is stale stage (outdated/stuck) label Aug 1, 2019
@stale
Copy link

stale bot commented Aug 15, 2019

This stale issue has been automatically closed. Thank you for your contributions.

@stale stale bot closed this as completed Aug 15, 2019
@k-zhai
Copy link

k-zhai commented Jun 12, 2020

@me-no-dev Is there a fix for this?

@me-no-dev
Copy link
Member

there will be

@mcoindeau
Copy link

Would be soooooo coool. Curently building with the unapproved PR with unknow side affect, hands shaking @ every line :)

@PlPt
Copy link

PlPt commented Jul 12, 2020

Move port definition to constructor and to it like EthernetServer from arduino-libs

Workaround till then, for using WifiServer and EthernetServer (from Ethernet.h) you can define in both begin Functions in Server.h with a default implementation, non virtual:

class Server: public Print
{
public:
	void begin(uint16_t port = 0) {};
       void begin() {};
};

It's not nice but it works when you want to use WifiServer and EthernetServer in your projects

@tig
Copy link

tig commented Jul 23, 2021

This issue should not be closed as it has not been resolved.

I'm just a user trying to build some cross platform Arduino libraries. I just spent an hour trying to figure this issue out only to find a dozen or so closed issues scattered across a bunch of repos with suggestions of lame workarounds but no fix.'

error: cannot declare field 'Commands::_shellServer' to be of 
abstract type 'EthernetServer

The fix is to change esp32 to use

@per1234 articulated the fix well here: arduino-libraries/Ethernet#88

The ArduinoCore-api repository contains the result of Project Chainsaw. This separates all the non-architecture specific code out of the core libraries so that the same code can be shared by all cores. This makes it much easier to maintain that code. The hope is that ArduinoCore-api will be used by the 3rd party hardware package authors in addition to its use by the official Arduino hardware packages. ArduinoCore-api is already in use in the Arduino megaAVR Boards package.

Server.h is part of ArduinoCore-api. If Arduino core for the ESP32 eventually switches to using ArduinoCore-api, they will be using the official Server.h, rather than their non-standard Server.h.

I get the sense that the esp32 maintainers do not want to do this, butI can't understand why.

In the meantime, if someone can suggest how I can get my cross-platform Arduino library build in platformio to automatically patch the esp32 Server.h as proposed here, I'd really appreciate it.

https://github.com/arduino-libraries/Ethernet/pull/107/files

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Resolution: Duplicate Issue is a duplicate of another issue
Projects
None yet
Development

No branches or pull requests

7 participants