Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Send TCP POST request at slower rate

Tags:

delphi

indy

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.

like image 400
kbickar Avatar asked Aug 10 '14 03:08

kbickar


1 Answers

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.

like image 161
Remy Lebeau Avatar answered Nov 02 '22 14:11

Remy Lebeau