sdfghj

Dependencies:   FTPClient SDFileSystem WIZnetInterface mbed

Fork of FTP_TESTClient by winwet w7500

Committer:
akshaytom
Date:
Thu Dec 14 04:50:55 2017 +0000
Revision:
1:b6196ce9efac
Parent:
0:e35dac7e4c95
asdfghj

Who changed what in which revision?

UserRevisionLine numberNew contents of line
wiznetw7500 0:e35dac7e4c95 1 #include "mbed.h"
wiznetw7500 0:e35dac7e4c95 2 #include "SDFileSystem.h"
wiznetw7500 0:e35dac7e4c95 3 #include "EthernetInterface.h"
wiznetw7500 0:e35dac7e4c95 4 #include "FTPClient.h"
wiznetw7500 0:e35dac7e4c95 5 #include <string.h>
wiznetw7500 0:e35dac7e4c95 6 #include <stdio.h>
wiznetw7500 0:e35dac7e4c95 7 #define FTP_SERVER_PORT 21
wiznetw7500 0:e35dac7e4c95 8 static char buf[256];
wiznetw7500 0:e35dac7e4c95 9 static char ID[]={"user"}; //Set FTPServer Login ID
wiznetw7500 0:e35dac7e4c95 10 static char PASSWORD[]={"1234"}; //Set FTPServer Login Password
wiznetw7500 0:e35dac7e4c95 11 FTPClient FTP(PB_3, PB_2, PB_1, PB_0, "sd"); // WIZwiki-W7500
wiznetw7500 0:e35dac7e4c95 12 Serial pc(USBTX, USBRX);
wiznetw7500 0:e35dac7e4c95 13 int main() {
wiznetw7500 0:e35dac7e4c95 14 pc.baud(9600);
wiznetw7500 0:e35dac7e4c95 15
wiznetw7500 0:e35dac7e4c95 16 pc.printf("------------------------------FTP Client Example-------------------------------------------!\r\n");
wiznetw7500 0:e35dac7e4c95 17
wiznetw7500 0:e35dac7e4c95 18
wiznetw7500 0:e35dac7e4c95 19 char ftpServer_control_ip_addr[] = "demo.wftpserver.com"; // FTP Server location
wiznetw7500 0:e35dac7e4c95 20 char* userid = "demo-user"; //FTP Server User ID
akshaytom 1:b6196ce9efac 21 char* pass = "demo-user"; //FTP Server Password
akshaytom 1:b6196ce9efac 22 EthernetInterface eth;
akshaytom 1:b6196ce9efac 23 uint8_t mac_addr[6] = {0x00, 0x08, 0xdc, 0x12, 0x34, 0x45};
akshaytom 1:b6196ce9efac 24 char IP_Addr[] = "192.168.0.101";
akshaytom 1:b6196ce9efac 25 char IP_Subnet[] = "255.255.255.0";
akshaytom 1:b6196ce9efac 26 char IP_Gateway[] = "192.168.0.1";
wiznetw7500 0:e35dac7e4c95 27 eth.init(mac_addr, IP_Addr, IP_Subnet, IP_Gateway); //Use Static
wiznetw7500 0:e35dac7e4c95 28 eth.connect();
akshaytom 1:b6196ce9efac 29 pc.printf("\nThe IP address of the client is %s\r\n",eth.getIPAddress());
wiznetw7500 0:e35dac7e4c95 30
wiznetw7500 0:e35dac7e4c95 31 while(1) {
akshaytom 1:b6196ce9efac 32 //char Msg_c = pc.getc();
akshaytom 1:b6196ce9efac 33
akshaytom 1:b6196ce9efac 34 //if(Msg_c==0x31)
akshaytom 1:b6196ce9efac 35 //{
wiznetw7500 0:e35dac7e4c95 36
akshaytom 1:b6196ce9efac 37 pc.printf("\nConnecting...FTPServer\r\nIP:%s, PORT:%d\r\n", ftpServer_control_ip_addr, FTP_SERVER_PORT);
akshaytom 1:b6196ce9efac 38 //pc.printf("Test\n");
akshaytom 1:b6196ce9efac 39
akshaytom 1:b6196ce9efac 40 //FTP.open("demo.wftpserver.com");
akshaytom 1:b6196ce9efac 41
akshaytom 1:b6196ce9efac 42 bool n = FTP.open("192.168.0.100", 21,"FTP","user");
akshaytom 1:b6196ce9efac 43
akshaytom 1:b6196ce9efac 44 //pc.printf("%d\r\n",n);
wiznetw7500 0:e35dac7e4c95 45 wait(10);
akshaytom 1:b6196ce9efac 46 printf("\nThe Files and folders available in the server are :\r\n");
wiznetw7500 0:e35dac7e4c95 47 FTP.ls();
wiznetw7500 0:e35dac7e4c95 48 printf("\r\n");
akshaytom 1:b6196ce9efac 49 wait(10);
wiznetw7500 0:e35dac7e4c95 50 printf("The Files in upload folder are :\r\n");
wiznetw7500 0:e35dac7e4c95 51 FTP.cd("/upload");
wiznetw7500 0:e35dac7e4c95 52 FTP.ls();
wiznetw7500 0:e35dac7e4c95 53 wait(10);
wiznetw7500 0:e35dac7e4c95 54 printf("The Files in download folder are :\r\n");
wiznetw7500 0:e35dac7e4c95 55 FTP.cd("/download");
wiznetw7500 0:e35dac7e4c95 56 FTP.ls();
wiznetw7500 0:e35dac7e4c95 57 printf("\r\n");
akshaytom 1:b6196ce9efac 58 wait(10);
wiznetw7500 0:e35dac7e4c95 59
akshaytom 1:b6196ce9efac 60 // }
wiznetw7500 0:e35dac7e4c95 61
wiznetw7500 0:e35dac7e4c95 62
wiznetw7500 0:e35dac7e4c95 63 }
wiznetw7500 0:e35dac7e4c95 64
wiznetw7500 0:e35dac7e4c95 65
wiznetw7500 0:e35dac7e4c95 66 }