-
Notifications
You must be signed in to change notification settings - Fork 13.3k
WiFiServer::write() write to all clients is not implemented #2743
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
Comments
@igrr is this something that we want to do for compatibility or consistency? |
I don't see a problem with adding a function to write to all clients. It wasn't implemented in the first place because that looked like an odd thing to do (no widely used protocol over TCP does that, AFAIK). Still, implementing this would not hurt and would improve compatibility. The other part, about |
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.
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.
Basic Infos
So I tried searching if this issue is already present but due to the mass it could be that I overlooked it, so apologies if this is a duplicate report.
Description
The WiFiServer currently doesn't support writing to all clients. Instead one has to keep track of the client instances and do that manually which leads to a bit more ugly code.
See: WiFiServer.cpp#L135
I would file a pull request but since I am no C++ expert, the list code is hard to read.
In general I would recommend refactoring the code to be in line with the Arduino's EthernetServer.
The key difference is that it handles the client array internally, hiding it from the user.
This means that
available
always returns the first readable client instead of only returning new connections likeWiFiServer
does.I agree that this is a design decision and that it would break exisiting code, so this is soley a proposal, but since I had to rewrite some code depending on the Platform (Arduino Mega vs ESP it would be awesome to have that consistent.
The text was updated successfully, but these errors were encountered: