I am using Arduino Mega R3 and WiFi shield to upload an image from SD card to a webpage.
The htm files are also stored in SD card.
I have noticed that the image takes too long to load (about 2 minutes for 10 KB jpg image!)
How can I speed the upload speed?
This is the part of my code that upload the image:
if (StrContains(HTTP_req, "GET /logo.jpg")) {
webFile = SD.open("logo.jpg");
if (webFile) {
client.println("HTTP/1.1 200 OK");
client.println();
}
}
if (webFile) {
Serial.println("");
Serial.print(webFile); Serial.println(" is available");
while(webFile.available()) {
client.write(webFile.read()); // send web page to client
}
webFile.close();
}
I have read about client.write(buffer, length) and reading more than one byte from SD card at once, such as this post:
I can do a lot better than that with the transfer code in zoomkat's ethernet code. I use a 64 byte buffer to transfer large files. Here is a 26.5K jpg image on a Mega and wifi shield. How long does it take you to get it? It isn't as fast as I hope it will eventually be, but better than 2 minutes. http://68.99.58.119/img/wolver.jpg
However, the wifi shield server is using only one socket at the present time, and sometimes poorly. I will post my server code in the playground when I get the bugs out of it. It isn't very stable when transferring multiple big files to the same client.