Skip to content

Wrong documentation of WiFiServer::write #5166

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
UlliBien opened this issue Sep 25, 2018 · 7 comments
Closed

Wrong documentation of WiFiServer::write #5166

UlliBien opened this issue Sep 25, 2018 · 7 comments

Comments

@UlliBien
Copy link

UlliBien commented Sep 25, 2018

In https://arduino-esp8266.readthedocs.io/en/latest/esp8266wifi/server-class.html write() points to https://www.arduino.cc/en/Reference/WiFiServerWrite. There is written:

Write data to all the clients connected to a server.

That is not true for this library. The method is not implemented:
size_t WiFiServer::write(const uint8_t *buffer, size_t size) { // write to all clients // not implemented (void) buffer; (void) size; return 0; }

@d-a-v
Copy link
Collaborator

d-a-v commented Sep 25, 2018

Is this function needed, or should we just update the doc ?

@RudyFiero
Copy link

Write data to all the clients connected to a server.

I can see a function like that as being useful but I do not think that should be the default behaviour. I wonder if the comment in that example is correct (for non-ESP8266 devices) or if it was a not quite write description.

What if you had two clients connected to the server but loaded with different sub-pages? It can really make a mess of things. But then there is the case of the same web page sending updated status.

bool WebSocketsServer::broadcastBIN(uint8_t * payload, size_t length, bool headerToPayload) {

This is useful, but it is a specific case, not the default.

@UlliBien
Copy link
Author

I think, it is not very useful. In deed, I did not expect the existence of such a function.

But what ever you the dics should fit to the code.

@devyte
Copy link
Collaborator

devyte commented Sep 29, 2018

Some comments here:

  • About whether it's useful or not, it's a matter of user application. Off the top of my head, I can think of a telnet example, where a programmed ESP reboot could be announced to all connected clients, like Linux does on its consoles. The use model is the server side initiates communication for some reason, and sends data to all connected clients.
  • Whether or not it's useful, Arduino specifies it, and we should aim for compatibility.
  • We're talking about TCP server sockets, not about websockets or the webserver.
  • l seem to remember seeing this before. Did you search the tracker? Could be no longer open, or a PR instead of issue.

@yoursunny
Copy link
Contributor

l seem to remember seeing this before. Did you search the tracker? Could be no longer open, or a PR instead of issue.

It's #2743.

@devyte
Copy link
Collaborator

devyte commented Oct 2, 2018

That's the one, thanks! If someone makes a PR I will review.

@earlephilhower
Copy link
Collaborator

Closed via #6338

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

No branches or pull requests

6 participants