Datalogging telnet session to sdcard

PaulS:
No, but I'll make you think. If you are to put all the mail that arrives for your neighbor in a box for the time he is on vacation, when do you get the box (open the file)? When do you tape the box up (close the file)?

BEFORE you write ANY code, you should write some comments that show that you have thought about the correct order of events.

// Is there a client with data?

// Open the file

// Read each character from the client, and write it to the file

// Close the file




Now, figure out where to put these comments in your code, and you'll see what the problem is, and what the solution is.

i dont quite understand. what your saying looks exactly like this

if (client2.connect(server2, 23)) {
    if (client2.available() == 0) delay(2000);
    while (client2.available() > 0)  //theres data to be read
    {   
    mySensorData2 = sd.open("PTData2.txt", FILE_WRITE); // open the file
    char c = client2.read();  //read "a" character?
    mySensorData2.print(c); //write it to the file
    mySensorData2.close(); //close the file 
      ftransfer2(); //init transfer
    }