100Kb file downloading from ESP12E server takes 15 min....Why ?

The passage here describes the current problem I am facing with data Acquisition from Board NODEMCU1.0 (ESP12-E).

I have written a program which analogs read in 2 ms( more precisely "within 2 ms"). This acts as web server if you go to the IP address of web server, a hex file is downloaded containing all the data. The problem is ,even for 1000 data point which should take less than 2 seconds it, it takes 15-30 min to download the file, which is weird.

I know that the data point is collected within 2 ms because the code checks for it. There is no way data acquisition is going on for that long.

Since I have little to no knowledge on TCP connection , can you guess What could be the problem.

Read this forum to know more( [SOLVED]Faster Uploading from ESP8266 - Programming Questions - Arduino Forum). The imp stuff start from #10 message, all above are rubbish.

TUNIOT__8905.ino (1.18 KB)

It appears you are writing 1 byte per packet. You should test where the delay is. Comment out the analog read first. I added start and stop serial output so you can measure the time required.

   Serial.print("Start...");
    for(int i=0;i<100000;i++)
    {
      if(millis()-prev<3)
      {
        uint_t a = 1;
//        uint8_t a=(analogRead(A0));
        client.write(a);
        prev=millis();
      }
     }
     Serial.println("stop");
    client.stop();

Then comment out the client.write.

    Serial.print("Start...");
    for(int i=0;i<100000;i++)
    {
      if(millis()-prev<3)
      {
        uint8_t a=(analogRead(A0));
//        client.write(a);
        prev=millis();
      }
     }
    Serial.println("stop");
    client.stop();

Does either work at the rate you expect?