yoyo

Fork of FTPClient by Akshay Tom

Revision:
1:2630b5456598
Parent:
0:61da21bfd120
Child:
2:dbbe55b239d5
--- a/FTPClient.cpp	Tue Jul 28 00:04:52 2015 +0000
+++ b/FTPClient.cpp	Tue Jul 28 23:30:59 2015 +0000
@@ -38,6 +38,7 @@
             printf("Received message from server: %s\r\n", rbuf);
         #endif
             if (!strncmp(rbuf, "220", 3)){
+                printf("%s\r\n", rbuf);
                 sprintf(sbuf, "user %s\r\n", id);             
                 FTPClientControlSock->send(sbuf, strlen(sbuf));
             }
@@ -372,6 +373,35 @@
     }
     else return 0;
 }
+bool FTPClient::quit(){
+    
+    if(blogin){
+    
+        sprintf(sbuf, "quit \r\n");             
+        FTPClientControlSock->send(sbuf, strlen(sbuf));
+        
+        while(!bquitflag){
+            size = FTPClientControlSock->receive(rbuf, sizeof(rbuf));
+            if(size > 0){
+            #ifdef DEBUG
+                printf("Received message from server: %s\r\n", rbuf);
+            #endif
+                if (!strncmp(rbuf, "250", 3)){
+                    printf("%s\r\n", rbuf);
+                    bquitflag = true;
+                }
+                else {
+                    return 0;
+                }
+            }  
+        }
+        
+        bquitflag = false;
+        blogin = false;
+        return 1;
+    }
+    else return 0;
+}
 int FTPClient::pportc(char * arg)
 {
     char* tok=0;