kbickar
kbickar

Reputation: 624

Send TCP POST request at slower rate

I have a function that uploads a file with a TIdHTTP Post request. It uses a TIdMultiPartFormDataStream for the file so is using the function

function TIdCustomHTTP.Post(AURL: string; ASource: TIdMultiPartFormDataStream): string;

This part works correctly, but I'd like to slow the rate it is sending so it uses less bandwidth.

Is there a way to loop a writebytes call or something so I could stick some sleeps in the middle and slow it down? I don't care about the response from the request.

Upvotes: 5

Views: 229

Answers (1)

Remy Lebeau
Remy Lebeau

Reputation: 597941

Indy has a TIdInterceptThrottler component for this very purpose. You can assign it to the TIdHTTP.Intercept property, and then set the TIdInterceptThrottler.SendBitsPerSec property as needed.

Upvotes: 8

Related Questions