Network Component
Version 6.3
MDK-Professional Middleware for IP Networking
|
The FTP client allows you to connect to a remote FTP server and perform various file operations. Using the FTP client you can:
The FTP client session starts with a connect request. The FTP client then opens a FTP connection to the server. The file operation to perform is specified in the connect request parameter. Once the file operation has completed, the FTP session ends and the connection closes. FTP session performs only one file operation. If you want to transfer more files, you need to start FTP session again.
All File System interface functions are located in FTP_Client_FS.c, which will be automatically added to your project's Network folder. The file is preconfigured for the File System Component, so no modifications are required. If you want to use another type of file system or to use a different storage media such as a hard disk, you need to add a similar file to your project.
The following functions are implemented in this module:
All required session parameters are given in the ftp_client_request callback function. This function is in the FTP_Client_UIF.c module. From the callback function, you can specify the username/password to access the FTP server, a working directory on the FTP server, a filename for the file operation, etc.
The FTP Client's operation mode is working with a relative path. This means the filename can not contain a path information. Instead of this, a working directory must be specified in the FTP_Client_UIF.c user interface module. After login, the FTP Client first changes the working directory to the path specified in user interface module, and then performs a file command. To add the module to your project, simply right-click on the Source group, select Add Net Item to Group, then click on User Code Template and scroll in the template files list until you find the FTP Client User Interface template. The FTP Client also supports directory manipulation and rename commands. This allows you to create or remove directories, and to rename files or directories on the server.
The following function is included in the Network Component library rl_net.h:
The end of a FTP Client operation can be notified to the user utilizing the ftp_client_notify function. It is part of the file FTP_Client_UIF.c module as well. You need to adapt the function to the application's needs.
Code Example FTP_Client_UIF.c
The FTP client configuration file Net_Config_FTP_Client.h contains the following settings: