Why's SD -> Ethernet Card -> Webbrowser so slow?

You must be more specific about how it works and what you expected. That code appears to add html to the end of every file. You shouldn't do that.

Comment out this line in your sketch. It will slow stuff up a bit.

                Serial.println("Pacote de dados de 64 bytes enviado!");

Serial monitor keeps showing 64bytes package sended a lot of times and images (108Kb is the biggest one) were much slower than it was before... It makes no sense because zoomkat tested in his sketch and says it worked, but in mine i really love it to work too, because it takes about 15 seconds to load that image...

blastboot: Serial monitor keeps showing 64bytes package sended a lot of times and images (108Kb is the biggest one) were much slower than it was before... It makes no sense because zoomkat tested in his sketch and says it worked, but in mine i really love it to work too, because it takes about 15 seconds to load that image...

Then you did not comment out that line. The Serial.println() call is slowing up your upload. Comment it out like this:

                // Serial.println("Pacote de dados de 64 bytes enviado!");

That was just for debugging.

ok, so no serial prints mixed with that part of the code, is it?

blastboot: ok, so no serial prints mixed with that part of the code, is it?

Correct. That was just so I could see how many packets were being sent, and it really slows up the transfer. Once you get the file sending ok, then no more Serial.println() in that loop.

Thanks again. I'll test it tomorrow and give a feedback. thanks! (again) XD

Ok, its working fine! Many thanks for this post ;)

While quite busy working on my Arduino home automation project, forgot to look at this forum. And see what happened: lots of discussion and good tips, thanks everbody, I'm gonna study all comments!

I have some problems with my server. When I want to acces the index.htm he didn’t show me nothing and i don’t know how to fix it (i use the transfer code from here , i’m new on this) :

          Serial.println("Opened!");
          //File types
          client.println("HTTP/1.1 200 OK");
          if (strstr(filename, ".htm") != 0)
            client.println("Content-Type: text/html");
          else if (strstr(filename, ".css") != 0)
            client.println("Content-Type: text/css");
            else if (strstr(filename, ".php") != 0)
            client.println("Content-Type: text/php");
          else if (strstr(filename, ".png") != 0)
            client.println("Content-Type: image/png");
          else if (strstr(filename, ".jpg") != 0)
            client.println("Content-Type: image/jpeg");
          else if (strstr(filename, ".gif") != 0)
            client.println("Content-Type: image/gif");
          else if (strstr(filename, ".3gp") != 0)
            client.println("Content-Type: video/mpeg");
          else if (strstr(filename, ".pdf") != 0)
            client.println("Content-Type: application/pdf");
          else if (strstr(filename, ".js") != 0)
            client.println("Content-Type: application/x-javascript");
          else if (strstr(filename, ".xml") != 0)
            client.println("Content-Type: application/xml");
          else
            client.println("Content-Type: text");
          client.println();

            
          byte clientBuf[64];
            int clientCount = 0;
           while(file.available()){
              clientBuf[clientCount] = file.read();
              clientCount++;
              if(clientCount > 63) {
                client.write(clientBuf,64);
                clientCount = 0;
              }
            }
              if(clientCount > 0) client.write(clientBuf,clientCount);
            

          client.print("<html><body>"); //HTML code starts here
          client.print("<P align=\"center\">"); 
          client.print("Hits since reset: <b>");   
          client.print(hits); //Print hits to client
          client.print("</b>
");

          photocellReading = analogRead(photocellPin); 
          client.print("Light reading: "); 
          client.print(photocellReading); //Prints light reading to client

          // A few threshholds
          if (photocellReading < 10) {
            client.print(" - Dark");
          } 
          else if (photocellReading < 200) {
            client.print(" - Dim");
          } 
          else if (photocellReading < 500) {
            client.print(" - Light");
          } 
          else if (photocellReading < 800) {
            client.print(" - Bright");
          } 
          else {
            client.print(" - Very bright");
          }

          client.print("</p></body></html>"); //HTML code ends here
          //End hit counter and light value

          if(strstr(clientline, "GET/&niv") !=0){
            Log = file.open(&root, rootFileName, O_READ | O_APPEND);
            if (Log){
              Serial.println(F("A enviar ficheiro LOG para download!"));
              byte clientBuffer[64];
              int clientCounter = 0;
                while(file.available()) {
                clientBuffer[clientCounter] = file.read();
                clientCounter++;
                if(clientCounter > 63) {
                client.println("Content-Disposition: attachment; filename=\"ficheiroLOG.txt\"");
                client.write(clientBuffer,64);
                clientCounter = 0;
              }
            }
              if(clientCounter > 0) client.write(clientBuffer,clientCounter);
            file.close();
        } 
        else {
          client.println("HTTP/1.1 404 Not Found");
          client.println("Content-Type: text/html");
          client.println();
          client.println("<h2>Error 404</h2>");
          client.println("");
        }
        break;
      }
    }
    digitalWrite(greenLEDandBEEP, HIGH);
    delay(1);
    digitalWrite(greenLEDandBEEP, LOW);
    client.stop();
  }

}
  }
}
//The End /*