Datalogging telnet session to sdcard

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.