hi,
i am writing a project of sending the thml code in sdcard to server.
at the begining every thing is woring good. but when the data become bigger and bigger, then ethernet hang,
it always hang at the same place. any person face the same problem also??
my code is something like this...
thank you
void sd_sendtable(EthernetClient & client,char filename[32], String token)
{
Serial.println(filename);
SdFile file2;
if (!file2.open(filename, O_READ)) restart();
int16_t data;
int countContent = 0;
boolean stopsend = false;
BUFFER sendContent;
memset(sendContent, 0, STRING_BUFFER_SIZE);
while ((data = file2.read()) >= 0 || stopsend == false){
if(data <= 0){
stopsend = true;
}
else{
//250 token
if(data == 250){
sendContent[countContent] = token[0];
sendContent[countContent + 1] = token[1];
sendContent[countContent + 2] = token[2];
sendContent[countContent + 3] = token[3];
sendContent[countContent + 4] = token[4];
sendContent[countContent + 5] = token[5];
countContent = countContent + 6;
}
else if(data == 220 || data == 221 || data == 222 || data == 223 || data == 224){
// remove the symbol
}
else
{
sendContent[countContent] = data;
countContent = countContent++;
}
}
if(countContent == STRING_BUFFER_SIZE - 20 || stopsend == true){
client.print(sendContent);
memset(sendContent, 0, STRING_BUFFER_SIZE);
countContent = 0;
}
}
// close the file:
file2.close();
}