PaulS:
If you put the { on a line BY ITSELF, and properly indented your code, you'd have:mySensorData2 = sd.open("PTData.txt", FILE_WRITE);
while (client2.available() > 0)
{
char c = client2.read();
mySensorData2.print(c);
mySensorData2.close();
ftransfer2();
}
So, if you connect to the telnet server, and there is no data immediately available, you wait two seconds, in the hope that data will arrive. After two seconds, you open the file. Then, if there is data to read, you read ONE character, print it to the file, close the file, and call some function whose name means nothing. Then, you read the rest of the characters, and try to write them to the file you closed, which of course won't work worth a damned. Give some SERIOUS thought about when to open the file and when to close it.
ftransfer2(); isnt just nothing it calls the file transfer
and i dont understand what you mean about when to close and open the file. will you please tell me what to do here