
sdfghj
Dependencies: FTPClient SDFileSystem WIZnetInterface mbed
Fork of FTP_TESTClient by
main.cpp
00001 #include "mbed.h" 00002 #include "SDFileSystem.h" 00003 #include "EthernetInterface.h" 00004 #include "FTPClient.h" 00005 #include <string.h> 00006 #include <stdio.h> 00007 #define FTP_SERVER_PORT 21 00008 static char buf[256]; 00009 static char ID[]={"user"}; //Set FTPServer Login ID 00010 static char PASSWORD[]={"1234"}; //Set FTPServer Login Password 00011 FTPClient FTP(PB_3, PB_2, PB_1, PB_0, "sd"); // WIZwiki-W7500 00012 Serial pc(USBTX, USBRX); 00013 int main() { 00014 pc.baud(9600); 00015 00016 pc.printf("------------------------------FTP Client Example-------------------------------------------!\r\n"); 00017 00018 00019 char ftpServer_control_ip_addr[] = "demo.wftpserver.com"; // FTP Server location 00020 char* userid = "demo-user"; //FTP Server User ID 00021 char* pass = "demo-user"; //FTP Server Password 00022 EthernetInterface eth; 00023 uint8_t mac_addr[6] = {0x00, 0x08, 0xdc, 0x12, 0x34, 0x45}; 00024 char IP_Addr[] = "192.168.0.101"; 00025 char IP_Subnet[] = "255.255.255.0"; 00026 char IP_Gateway[] = "192.168.0.1"; 00027 eth.init(mac_addr, IP_Addr, IP_Subnet, IP_Gateway); //Use Static 00028 eth.connect(); 00029 pc.printf("\nThe IP address of the client is %s\r\n",eth.getIPAddress()); 00030 00031 while(1) { 00032 //char Msg_c = pc.getc(); 00033 00034 //if(Msg_c==0x31) 00035 //{ 00036 00037 pc.printf("\nConnecting...FTPServer\r\nIP:%s, PORT:%d\r\n", ftpServer_control_ip_addr, FTP_SERVER_PORT); 00038 //pc.printf("Test\n"); 00039 00040 //FTP.open("demo.wftpserver.com"); 00041 00042 bool n = FTP.open("192.168.0.100", 21,"FTP","user"); 00043 00044 //pc.printf("%d\r\n",n); 00045 wait(10); 00046 printf("\nThe Files and folders available in the server are :\r\n"); 00047 FTP.ls(); 00048 printf("\r\n"); 00049 wait(10); 00050 printf("The Files in upload folder are :\r\n"); 00051 FTP.cd("/upload"); 00052 FTP.ls(); 00053 wait(10); 00054 printf("The Files in download folder are :\r\n"); 00055 FTP.cd("/download"); 00056 FTP.ls(); 00057 printf("\r\n"); 00058 wait(10); 00059 00060 // } 00061 00062 00063 } 00064 00065 00066 }
Generated on Fri Jul 15 2022 03:44:12 by
