RepeatUntil
RepeatUntil

Reputation: 2330

Delphi - indy send post using multiple IdHTTP in the same time

How can I send multiple post requests using TIdHTTP at the same time?

lHTTP1.Post('http://'+cURL+'/build.php?',lParamList, ResponseContent);
lHTTP2.Post('http://'+cURL+'/build.php?',lParamList, ResponseContent);
lHTTP3.Post('http://'+cURL+'/build.php?',lParamList, ResponseContent);

I tried using three threads to do that, but there is a one second delay between every post message.

How can I send all the post messages in the same second?

Upvotes: 0

Views: 948

Answers (1)

Remy Lebeau
Remy Lebeau

Reputation: 598134

Since TIdHTTP is a blocking component, using separate threads is the correct approach. The 1s delay on each post could be related to how the OS schedules threads, or it might be related to network delays, or you might be using a version of Indy that has internal delays (for instance, if an HTTP server sends a 3xx response to a POST request, TIdHTTP waits up to 5s to make sure the server sends a proper response body - some buggy servers do not). It is difficult to know where your 1s delay is actually occurring. You will have to debug/profile your project to find out, we can't do that for you.

Upvotes: 2

Related Questions