WiFi Client Slow GET requests

Hello there! (General Kenobi...)

I've got a project where one ESP8266 acts as a web server (and access point) while another acts as an HTTP client (and station). The client does a GET of the information on a particular page on the server, and it works fine, but...

It's kind of slow. This is going to sound silly, but it takes about 5 seconds for the station/client to connect to the AP/server and perform the GET. It actually slows down something that I was hoping to have go much faster, and it makes me wonder if there is anything I could do with my GET request to make it pull the data faster.

Here's the code from the AP/server:

void handleSettings() {
  String strSpeed = String(speed);
  String strSound = String(sound);
  String strDuration = String(duration);
  String strSettings = strSpeed + "," + strSound + "," + strDuration;
  webserver.send(200, "text/plain", strSettings);
}

And here's the code from the station/client:

if (client.connect(ap, 80)) {
    Serial.println("Connected to Transmitter");  
    String url = "/settings";
    client.print(String("GET ") + url + " HTTP/1.1\r\n" + "Host: " + ap + "\r\n" + "Connection: close\r\n\r\n");
    delay(10);
    while(client.available()){
      line = client.readStringUntil('\r');
    }

Obviously, I'm GETting three settings that are posted on the /settings page (speed, sound, and duration). Right now, I'm just putting those three settings on the settings page (they look like three numbers separated by commas - like 3,2,2) and then using Substring to split them up for the client to use. Is there a better/faster way to do this?

Thanks!
Matt

Other than using String I don't see any serious issues with these snippets. So, as usual, the problem is most likely in the part you didn't post.

Try making two minimal sketches that demonstrate the problem, and post those.

Just an update for anyone else reading this: I'm still not sure if there is a way to speed up my GET requests, but I did improve my process by adding in GET request retries. That way, I could allow multiple units to connect to my web server ESP at once, then they would each submit GET requests and if the request failed, they'd immediately retry (just a big while loop retrying the GET request).

The net result is that the devices all get the info they need within a few seconds total, which I can dela with.

The delay is because after read all lines client.available() waits 5 seconds for another one.
You can send "EOL" as last line and if you receive this line on client side just break the loop

void handleSettings() {
  String strSpeed = String(speed);
  String strSound = String(sound);
  String strDuration = String(duration);
  String strSettings = strSpeed + "," + strSound + "," + strDuration;
  webserver.send(200, "text/plain", strSettings + "\nEOF");
}
if (client.connect(ap, 80)) {
    Serial.println("Connected to Transmitter");  
    String url = "/settings";
    client.print(String("GET ") + url + " HTTP/1.1\r\n" + "Host: " + ap + "\r\n" + "Connection: close\r\n\r\n");
    delay(10);
    while(client.available()){
      line = client.readStringUntil('\r');
      // your code with "line"
      if (line == "EOF") {
        client.stop();
        break;
      }
    }