Skip to content

Update WiFiServer docs for ::write(all clients) #6338

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

Merged
merged 4 commits into from
Jul 25, 2019

Conversation

earlephilhower
Copy link
Collaborator

Fixes #5116
Fixes #2743

The Arduino WiFiClient object allows sending the same packet to all
connected clients of a WiFiServer. In their implementation it may make
sense, but on the 8266 with things like SSL it doesn't.

Update the docs to note that WiFiServer::write() is a no-op, and that
the app should use the WiFiCliebnt::write() on all connected clients as
appropriate.

Fixes esp8266#5116
Fixes esp8266#2743

The Arduino WiFiClient object allows sending the same packet to all
connected clients of a WiFiServer.  In their implementation it may make
sense, but on the 8266 with things like SSL it doesn't.

Update the docs to note that WiFiServer::write() is a no-op, and that
the app should use the WiFiCliebnt::write() on all connected clients as
appropriate.
@earlephilhower earlephilhower requested review from d-a-v and devyte July 24, 2019 20:13
Copy link
Collaborator

@d-a-v d-a-v left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This call is impossible to cleanly implement in any environment without a heavy infrastructure (even glibc doesn't have it).

addition:
Why is multicast existing with UDP and not TCP ?
That would be the answer to wifiserver.write() implementation complexity

@d-a-v d-a-v merged commit 76ed52c into esp8266:master Jul 25, 2019
@JAndrassy
Copy link
Contributor

why implement Arduino Server class at all? there is no use case where a server object is useful as Server.

@d-a-v
Copy link
Collaborator

d-a-v commented Jul 25, 2019

@JAndrassy
WiFiServer is needed to create new WiFiClient connections associated to a server port (like http/80).
There is a ::write() method which is supposed to send data to all currently connected client, that we don't implement.
Maybe I didn't understand your comment.

@JAndrassy
Copy link
Contributor

JAndrassy commented Jul 25, 2019

I recently made a generic ArduinoOTA library for AVR, SAMD, nRF5, esp8266, esp32 for many different networking libraries (for example to upload to esp8266 over Ethernet). The code of the library interacts with client object as Client class. And there is a server to receive the binary, but there was no use for Server base class. it has only begin(), but can't have available() because the return type of available() is the class derived from Client class. So there is no real use of the Server class as base class. I used C++ template to work with actual server class (ArduinoOTA.h)

Now I write a new WiFiEsp library (Arduino WiFi API over AT commands of connected esp8266). I decided not to derive the WiFiServer class from Server class in this library. Then I don't need to add dummy write(b) and can add optional parameters to begin(). And all use cases are still supported, except of the never used "write to all clients" feature.

TL;DR Arduino API Server class is useles

@earlephilhower earlephilhower deleted the serversilliness branch July 25, 2019 16:42
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.

WiFiServer::write() write to all clients is not implemented
3 participants