Your new topic does not fit any of the above??? Check first. Then post here. Thanks.

Moderator: igrr

User avatar
By resweet
#26022 Just going to 1.6.5 did not fix things, but changing to a single client.print(...) call seemed to fix things. I wonder if I then had a long enough string that it was over some threshold that kept it from waiting for additional stuff. I see that the WiFiClient.h interface has a flush() method. Should I be calling it?
User avatar
By martinayotte
#26030 No, you should not call flush(), except if you want to force sending packet, which is what you prefer to be delayed until buffer is full.

Did you figured out which version your are using, because the issue of the old version was like flush() been called on every print(). You can find the version number by looking at the folder names in ~/.arduino15/packages/esp8266/hardware/esp8266/. If you see more than one folder there, you have a mix of several versions. Delete all old ones, except the latest one, such as 1.6.5-947-g39819f0.

BTW, I've done a small test I've done 2 months ago when facing the issue, and the bug didn't came back in version using 1.6.5-947-g39819f0. This code is printed over telnet within 2 seconds :

Code: Select all        for (int i = 0; i < 1000; i++) {
          String str = ">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> Line #" + String(i);
          client.println(str);
        }
User avatar
By Sgt laGrange
#28943 This thread is a bit dated, but I thought I'd share my experience in case somebody stumbles upon in via Google (as I did).

Had a similar problem with HTTP post headers being printed one by one to the client. The printing took way too long (over 5 seconds), although the amount of data was limited. Upon further investigation it turned out that it was always the last client.println statement that took the longest (approx. 5 seconds as opposed to a dozen or so milliseconds for other prints). That was the case even when it contained a minimal portion of the whole POST request, or, for that matter, was empty. It was also independent of the amout of data (I suspected buffer overflow and limited the amount of data being printed).

What helped was to use client.print() instead of client.println() for the last portion. Then the duration of the last print was the same as the previous ones.

I'm new to this and this may be something obvious but I would be curious to hear in case anyone has an explanation to this.

I am using vanilla ESP-12 over the 1.6.5 Arduino IDE with 1.6.5-947 package.
User avatar
By martinayotte
#28948 Are you sure that only the 1.6.5-947 is under your Arduino IDE and that there is no older version still present ?
For all peoples I've help about this issue, they had older versions sitting around ...