Topic Path: Symbol Reference > Classes > TIdFTP Class > TIdFTP Methods > Connect Method
TIdFTP.Connect Method

Opens the connection to the server for the FTP session.

procedure Connect; override;

Connect is an overridden method in TIdFTP used to perform the FTP protocol exchanges required when establishing a new FTP client session. Connect also ensures that settings in the FTP client reflect the current state for the new FTP session. 

Set values in the Host and Port properties prior to calling Connect. 

Connect examines values in ProxySettings to determine if an intermediate connection to a proxy server is used for the FTP client session. When the ProxyType and Host properties (in ProxySettings) indicate a proxy is used, these copied to the Host and Port properties for the FTP client. 

Connect calls the inherited Connect method to establish the connection, optionally using TLS when UseTLS contains values that indicate uses on the transport. 

Connect captures the inital message from the FTP server in the Greeting property, and causes the OnBannerBeforeLogin event handler to be be triggered. 

When AutoLogin contains True, Connect will automatically execute the Login method and trigger the OnAfterLogin event handler. This will require values in the Username and Password properties to be provided prior to calling Connect. Similar values in ProxySettings must also be provided (when used) prior to calling Connect. 

Following execution of the Login method, values in UsingNATFAstTrack and UsingSFTP are also updated to reflect their current state. 

Other actions performed when AutoLogin contains True include setting the value in SystemDesc, and checking for support of the FTP SITE ZONE feature in the Capabilities for the server. When SITE ZONE is supported, time zone information if captured and stored for the FTP session. 

Finally, Connect triggers the OnStatus event handler to indicate that the FTP client session is ready for use. 

Any exceptions raised during processing in the Connect method will cause the Disconnect method to be called for the client, and the exception is re-reaised for the application.

Copyright 1993-2006, Chad Z. Hower (aka Kudzu) and the Indy Pit Crew. All rights reserved.
Post feedback to the Indy Docs Newsgroup.