-
Notifications
You must be signed in to change notification settings - Fork 7.4k
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
WiFiServer - deprecate available(), use accept() everywhere #8860
Conversation
esp8266 and esp32 server.available() is not implemented as documented it is implemented like server.accept() is documented by Arduino
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM - It still is back compatible by keeping the available()
as it is, but with a warning for being deprecated.
More information about the argument that @JAndrassy has made:
Based on the documentation from https://www.arduino.cc/reference/en/libraries/wifi/server.available/
The method available()
inherits from the Stream utility class. Therefore it should tell how many bytes are ready for reading.
The PR is correct in changing it to accept()
which is how it was implemented.
https://www.arduino.cc/reference/en/libraries/ethernet/server.accept/
Thanks @JAndrassy !! |
Beautiful work. Well done! |
@mrengineer7777 |
Server inherits from Print. It doesn't inherit from Stream. documentation for `server.available()':
My NetApiHelpers library has ArduinoWiFiServer for ESP32. This has correct |
In esp8266 and esp32 Arduino WiFi library server.available() was never implemented as documented. It is implemented like server.accept() is documented by Arduino.
server.accept() was an alias for the server.available() from the beginning here in esp32 Arduino platform.
I think with the new major version 3 this should be done. esp8266 Arduino did this change for version 3 too.