Skip to content

ESP8266HttpClient never seems to finish large files when using lwip2  #4176

Closed
@schlaegerz

Description

@schlaegerz

Basic Infos

Hardware

Hardware: NodeMCU 1.0 (ESP-12E)
Core Version: 2.4

Description

I am trying to download a file that is around 10MB, and on lwip2 the file download seems to get around 1MB done and then just stops. If i go back to 1.4 then it finishes the download, but takes about 4min.

Settings in IDE

Module: NodeMCU 1.0 (ESP-12E)
Flash Size: 4M
CPU Frequency: 160Mhz
Flash Mode:
Upload Using: Serial

Code:

while (success &&
http.connected() &&
(downloadRemaining > 0 || downloadRemaining == -1)
) {
// get available data size

    auto size = stream->available();
    if (size > 0) {
        auto c = stream->readBytes(cur_buffer, ((size > CHUNK_SIZE) ? CHUNK_SIZE : size));
        cur_buffer = cur_buffer + c;
        auto totalSize = cur_buffer - buff;
        if (totalSize + 2* CHUNK_SIZE > buffSize)
        {
            cur_buffer = buff;
        }
         
        hasDownload = true;
        success &= c > 0;
        if (downloadRemaining > 0) {
            downloadRemaining -= c;
        }
        lastDownloadTime = millis();
    }
    yield();
    //delay(1);
    static int i = 0;
    i++;
    if (i % 2000 == 0)
    {
        Serial.println(downloadRemaining);
    }
}

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions