Go Down

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

Dmitron1036

I have a classic code:
Code: [Select]

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

if(SD.exists(GetData)){
  webFile = SD.open(GetData);
}

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


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

Dmitron1036

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
}

PaulS

Quote
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.

derVernichter

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.
https://github.com/tuedelue/iotduino

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!

Arduino
via Egeo 16
Torino, 10131
Italy