In what situations would one use server.print()? If I understand correctly, server.print() sends a message to all clients connected to an Arduino (configured as a server), while client.print() sends a message to only one client at a time? How would the WifiWebServer example sketch need to be modified in order to use server.print()?
I find it extremely confusing that "client" is used with two different, nearly contradictory meanings, as noted here.
for http server the print-to-all-clients is not useful because it is a request/response protocol.
a telnet chat or OTA logging is an example of useful print-to-all-clients
void loop() {
WiFiClient client = server.available(); // returns first client which has data to read or a 'false' client
if (client) { // client is true only if it is connected and has data to read
String s = client.readStringUntil('\n'); // read the message incoming from one of the clients
s.trim(); // trim eventual \r
Serial.println(s); // print the message to Serial Monitor
client.print("echo: "); // this is only for the sending client
server.println(s); // send the message to all connected clients
server.flush(); // flush the buffers
}
}