Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Fork of FTPClient by
Revision 1:2630b5456598, committed 2015-07-28
- Comitter:
- Ricky_Kwon
- Date:
- Tue Jul 28 23:30:59 2015 +0000
- Parent:
- 0:61da21bfd120
- Child:
- 2:dbbe55b239d5
- Commit message:
- add function(quit())
Changed in this revision
| FTPClient.cpp | Show annotated file Show diff for this revision Revisions of this file |
| FTPClient.h | Show annotated file Show diff for this revision Revisions of this file |
--- 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;
--- a/FTPClient.h Tue Jul 28 00:04:52 2015 +0000
+++ b/FTPClient.h Tue Jul 28 23:30:59 2015 +0000
@@ -16,8 +16,12 @@
bool fdelete(char* filename);
bool mkdir(char* dirname);
bool cd(char* dirname);
+ bool quit();
int pportc(char * arg);
+
+
+private:
TCPSocketConnection* FTPClientControlSock;
TCPSocketConnection* FTPClientDataSock;
@@ -30,6 +34,7 @@
bool bfdeleteflag;
bool bmkdirflag;
bool bcdflag;
+ bool bquitflag;
char ftpServer_data_ip_addr[4];
char ftpServer_data_ip_addr_str[20];
@@ -43,8 +48,6 @@
int remain_filesize;
int send_byte;
int size;
-
-private:
FILE *fp;
SDFileSystem _SDFileSystem;
};
