Skip to content

w5100 buffer overflow #3144

Closed
Closed
@WildOrangutan

Description

@WildOrangutan

Hi!
Please implement something like this, to avoid w5100 buffer overflow, when constantly sending data as fast as possible:

int EthernetClient::free() {
    if (_sock != MAX_SOCK_NUM)
        return W5100.getTXFreeSize(_sock);
   return 0;
}

And then use it in examples like this:

while (file.available() > 0) {
    if (client.free() > 0) { // This was key to solving the issue
        c = file.read();
        client.print((char)c);
    } else { // No free buffer? Ok, I'll wait a couple of millis...
        delay(1);
    }
}
file.close();

Source: http://www.toptal.com/c/how-i-made-a-fully-functional-arduino-weather-station-for-300

Metadata

Metadata

Assignees

Labels

Library: EthernetThe Ethernet Arduino libraryfeature requestA request to make an enhancement (not a bug fix)

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions