exchanging files between sd card and server

Dependencies:   FTPClient SDFileSystem WIZnetInterface mbed

Fork of FTP_SD_card_wizwikiw7500 by kulwant singh

Revision:
5:07ae574bbd4c
Parent:
4:3ccf1cd64c84
--- a/main.cpp	Wed Jan 31 02:54:37 2018 +0000
+++ b/main.cpp	Thu Feb 08 06:11:20 2018 +0000
@@ -1,16 +1,26 @@
 #include "mbed.h"
 #include "SDFileSystem.h"
 #include "EthernetInterface.h"
+//#include "WizFi310Interface.h"
 #include "FTPClient.h"
 #include <string.h>
 #include <stdio.h>
 #define FTP_SERVER_PORT     21
+
+#define SECURE WizFi310::SEC_WPA2_MIXED
+#define SSID "CDI"
+#define PASS "Cdi*1717"
  static char buf[256];
  
 FTPClient FTP(PB_3, PB_2, PB_1, PB_0, "sd"); // WIZwiki-W7500 
 Serial pc(USBTX, USBRX);
+
+//#if defined(TARGET_WIZwiki_W7500)
+//    WizFi310Interface wizfi310(D1, D0, D7, D6, D8, NC, 115200);
+//    Serial pc(USBTX, USBRX);
+//#endif
 int main() {
-    pc.baud(9600);
+    pc.baud(115200);
     
     pc.printf("------------------------------FTP Client Example-------------------------------------------!\r\n"); 
       
@@ -24,6 +34,10 @@
     char IP_Gateway[] = "192.168.0.1";
     eth.init(mac_addr, IP_Addr, IP_Subnet, IP_Gateway); //Use Static
     eth.connect();
+    //wizfi310.init(mac_addr, IP_Addr, IP_Subnet, IP_Gateway);
+//    if ( wizfi310.connect(SECURE, SSID, PASS, WizFi310::WM_STATION))      return -1;
+//    printf("After Connect. \r\n");
+//    printf("IP Address is %s\r\n", wizfi310.getIPAddress());
     pc.printf("\nThe IP address of the client is %s\r\n",eth.getIPAddress());
     
     //while(1) {     
@@ -32,20 +46,20 @@
                    /*TO connect to online Server uncomment the below line*/ 
                     //FTP.open("demo.wftpserver.com");
                     
-                    //bool n  = FTP.open("192.168.0.100", 21,"FTP","user");
-                    bool n  = FTP.open("demo.wftpserver.com", 21,"demo-user","demo-user");
+                    bool n  = FTP.open("192.168.0.100", 21,"FTP","user");
+                    //bool n  = FTP.open("demo.wftpserver.com", 21,"demo-user","demo-user");
                     printf("\nThe Files and folders available in the server are :\r\n");
                     FTP.ls();
                     printf("\r\n");
                     wait(10);
-                    //FTP.getfile("/sd/mbl123.txt","m.txt");
+                    FTP.getfile("/sd/mbl123.txt","m.txt");
                     printf("The Files in upload folder are :\r\n");
                     FTP.cd("/upload");
                     FTP.ls();
                     //FTP.getfile("/sd/bcdef.jpeg","Label.jpeg");
                     
                     wait(10);
-                    //FTP.putfile("/sd/vlcsnap-3279000.jpg","manas2.jpg");
+                    FTP.putfile("/sd/vlcsnap-3279000.jpg","test.jpg");
                     printf("The Files in download folder are :\r\n");
                     FTP.cd("/download");
                     FTP.ls();