Ethernet client.print

Hi,

I have been trying to optimize my ethernet code.

But, for some reason when i try to know how many bytes i have sent to the W5100 i always get zero with the following code

while(TempFile.available()){
        c = TempFile.read();
        do{
                       sentbytes = client.print(FTTString);
                       Serial.println(sentbytes);
                 }while(sentbytes == 0);
}

I know that i´m able to write because if i use the following code instead, i have no problem in writting

while(TempFile.available()){
        c = TempFile.read();
              client.print(c);
          delay(10);
}

Any ideas why sentbytes is always 0?

You did not post enough of your code to see the problem, but I can guess. What is in FTTString? If no characters except a zero terminator, then that return value is correct. http://arduino.cc/en/Reference/ClientPrint

            while(TempFile.available()){
        c = TempFile.read();
        do{
                       sentbytes = client.print(FTTString);
                       Serial.println(sentbytes);
                 }while(sentbytes == 0);
}

What is the point of reading into "c" in the loop, if you never use it?

Sorry

I have detected the problem, when trying to post all the code... The usual, forgotten comment...