I am have created a controller for my pool where i can set and run all of the functions via a web browser. The trouble is it is extremely slow. It all works quite well but takes forever.
I was running through some posts here in the forum and think i have found what my trouble is although i don't know were to find the solution to fix it.
The post i am referring to is: Arduino + Ethernet - webserver is SLOW - Networking, Protocols, and Devices - Arduino Forum
I believe my problem is addressed in the 3rd reply by "zimm0who0net" which says:
The reason is because each call to client.write() will send a full IP packet with only the one character in it. That's insane overhead. To make things a-m-a-z-i-n-g-l-y faster, read blocks of data from the file and then write the blocks to the buffer.
Incidentally, make your block size 512 bytes. Why? Well, when you read data with the SD library it'll read into it's own internal cache buffer and then copy that data to your passed in buffer. That's an extra memcpy step that you don't really need. If you make your buffer exactly 512 bytes, it'll bypass the internal cache, and write data directly from the card to your buffer.
My code contains the following:
if (webFile) {
while(webFile.available()) {
client.write(webFile.read());
}
Does anyone know where i may be able to find some information on how to fix this?