5.2 FTPService
The FTPService allows an application to send and receive files to or from an FTP (file transfer protocol) server. FTP is a TCP based service, widely used on the Internet and to support e-Commerce.
The FTPService supports standard and secure mode FTP. It provides a rich set of service commands for:
- Establishing a connection with a FTP server.
- Creating, deleting, renaming and navigating folders on the FTP server.
- Creating and deleting files
- Transferring files to or from the FTP server.
Related Services
The FTPService is not dependent on other services. Using just this one service a user can access and transfer files, from and to, another host over a network (assuming FTP is supported between your local and remote servers).
However, depending on the requirements of your application, you may wish, for example, to create a PDF file then distribute this file using the FTP service.
Technical Specifications
- FTP utilizes two ports; a 'data' port and a 'control' port (also referred to as the command port).
When your local FTP server first connects to the remote FTP server, it establishes a 'control session', to allow the two servers to give each other commands (e.g. change directories, get a file etc...). To initiate this connection your local server has to have a port of entry into the remote FTP server, like a door for your local server to knock on and the remote FTP server to open. The remote server probably has several entry ports, but most servers set aside Port 21 to receive connections from FTP clients.
In order for your local server to transfer files, a second session is established between your computer and the remote FTP server, the 'data session'. In normal FTP, the remote FTP server initiates this second connection using another port (typically Port 20).