|Subject:||Re: TIdInterceptThrottler problem|
|Posted by:||Remy Lebeau (TeamB) (email@example.com)|
|Date:||Wed, 15 Dec 2004|
"Michael J. Leaver" <firstname.lastname@example.org> wrote in message
> Hi, I'm using the TIdInterceptThrottler class (Indy 10) to try
> and limit the bandwidth used by my FTP client. However, it
> doesn't seem to be working.
Nor should it because you are not using it properly.
That will not work. You are assigning the throttle to the *command*
connection, not the *data* connection. Keep in mind that the FTP protocol
uses multiple socket connections - one for sending commands, and each file
transfer has its own individual socket.
To do what you are asking, you need to assign the throttle to the *data*
connections that are used for each transfer. You can use the
OnDataChannelCreate event for that, ie:
procedure TForm1.IdFTP1DataChannelCreate(ASender: TObject; ADataChannel:
LThrottle := TIdInterceptThrottler.Create(ADataChannel);
ADataChannel.IOHandler.Intercept := LThrottle;
LThrottle.BitsPerSec := 8192; // 1K
procedure TForm1.IdFTP1DataChannelDestroy(ASender: TObject;
with ADataChannel.IOHandler do begin
Intercept := nil;
TIdInterceptThrottler problem posted by Michael J. Leaver on Wed, 15 Dec 2004