Indy 9
|
TIdDataChannelThread = class(TIdThread)
TIdDataChannelThread provides properties that represent the connection used for an acive or passive data channel for the FTP client, the control channel from the threaded client, and TIdRFCReply properties representing the success and error messages used when performing data transfer. TIdDataChannelThread provides methods that create the active or passive connection, initialize the data channel, or start the thread of execution.
TIdDataChannelThread can represent an active or a passive connection type on the data channel. When passive connections are used, the connection is constructed as a TIdSimpleServer object instance. When the TIdDataChannelThread thread is started, the data channel will be used to listen for a client connection.
When active connections are opened by the client thread, the connection is constructed using a TIdTCPClient object instance bound to the FTP data port 20. When the TIdDataChannelThread thread is started, the data channel will be connected.
During execution, the data channel thread uses the Data property to access the TStrings or TStream values used during the data transfer operation. After performing the transfer operation, the socket for the data channel in the thread is disconnected, and the Success or Error message is written using the control channel for the threaded client connection. The data channel thread is stopped after execution of the transfer operation.
TIdDataChannelThread is the thread type created for use in the TIdFTPServerThread.DataChannel property in a threaded client connection. The data channel thread exists for the lifetime of the threaded client connection. It is initalized and started prior to data transfer operations, and suspended when the data transfer operation is completed.
property ErrorReply: TIdRFCReply;
Use OKReply to specify the message used when a data transfer operation is successful.
property OKReply: TIdRFCReply;
Use ErrorReply to specify the message used when an error occurs during a data transfer operation.
constructor Create(APASV: Boolean; AControlConnection: TIdTCPServerConnection; const ADefaultDataPort: Integer = IdPORT_FTP_DATA); reintroduce;
Create also allocates resources need for object properties, including:
When the threaded data channel uses Passive connections, as indicated in APASV, DataChannel will refer to a TIdSimpleServer object instance bound to the IP address used in the ControlChannel for the thread. When active connections are used, DataChannel will refer to a TIdTCPClient bound to port number 20, as required by the FTP protocol.
destructor Destroy; override;
procedure SetupDataChannel(const AIP: string; APort: Integer);
SetupDataChannel is used when TIdFTPServer responds to the FTP PORT or PASV command verbs from a thread FTP client connection.
procedure StartThread(AOperation: TIdFTPOperation);
StartThread determines the socket connection type required for the active or passive client connection, and performs the actions needed to allow the client connection for the DataChannel. When passive connections are used, the TIdSimpleServer object instance in DataChannel will be used to listen for the client connection. When active connections are used, the TIdTCPClient object instance in DataChannel will be connected.
Use SetupDataChannel to configure the IP address and port number to used for the differing client connection types.
If an exceptionm occurs while establishing the connection for DataChannel, the values in ErrorReply are written to the FTP client using the ControlChannel.
When successfully completed, StartThread will begin execution of the threaded data channel for use with FTP data transfer operation.