Go Down

Topic: Web-server : how to increase downloading speed? (Read 202 times) previous topic - next topic


I have a classic code:
Code: [Select]

EthernetClient client = server.available();  // try to get client
File webFile;

  webFile = SD.open(GetData);

while(webFile.available() && File_type == true) {
client.write(webFile.read()); // send web page to client

The download speed is 4kB/s.
How can I increase it?
I guess I need to use some buffer fo reading and writing?


I guess I should use
stream.readBytes(buffer, length)
or stream.readBytesUntil(character, buffer, length)

Code: [Select]

while(webFile.available() && File_type == true) {
client.write(  webFile.readBytesUntil(character, buffer, length)  ); // send web page to client


I guess I should use
Well, you could perform a test, instead of guessing. I don't need to guess to know that sending 512 byte TCP packets that contain one byte of payload is going to be orders of magnitude slower than sending 512 byte TCP packets that contain 64 bytes of payload.
The art of getting good answers lies in asking good questions.


You should have a look into the ethernet library. my tests with an older version revealed that the library sends 1b segments causing lots of overhead.

Go Up

Please enter a valid email to subscribe

Confirm your email address

We need to confirm your email address.
To complete the subscription, please click the link in the email we just sent you.

Thank you for subscribing!

via Egeo 16
Torino, 10131