|
FTP Client is a Clever Internet Suite component that implements FTP and FTPS (FTP + SSL) protocols. You can explicitly switch between these two protocols by using the UseSSL component property. All other properties, methods and component events are identical for both FTP and FTPS protocols.
As an example the FTP Client component can be used with the FTP server provided by http://www.weonlydo.com/. You can transfer data between FTP Client and the specified server using an SSL encrypted channel. Most of the SSL enabled servers require the specified client certificate installed on the client PC. So in order to open an SSL connection you need to install the client certificate provided along with the FTP server. The Clever Internet Suite FTP client will locate and establish a secured connection automatically without requiring any actions from the user.
The sample below demonstrates how to use the FTP Client component in the SSL mode:
procedure TForm1.Button1Click(Sender: TObject); var Destination: TStream; begin clFTP1.Server := 'ftp.myserver.com'; clFTP1.UserName := 'john'; clFTP1.Password := 'psw'; clFTP1.UseTLS := ctAutomatic; clFTP1.Open(); Destination := TFileStream.Create('MyDocument.txt', fmCreate); try clFTP1.GetFile('MyDocument.txt', Destination); finally Destination.Free(); end; clFTP1.Close(); end; |
In FTP Server, you have the following two SSL / TLS options: Implicit SSL negotiation and Explicit SSL negotiation.
The sample below demonstrates how to use the TclFtpServer component in the SSL mode:
procedure TMainForm.btnStartClick(Sender: TObject); begin clFtpServer1.UseTLS := stImplicit; clFtpServer1.Port := StrToInt(edtPort.Text); clFtpServer1.RootDir := edtRootDir.Text; clFtpServer1.Start(); end; |
Please note ! The current version of both FTP Client and FTP Server can work only in passive FTP mode while communicating via SSL / TLS protocol.
|