Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7576427
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T16:55:04+00:00 2026-05-30T16:55:04+00:00

It’s the first time I work on a multi-threads application with Delphi so all

  • 0

It’s the first time I work on a multi-threads application with Delphi so all is still fesh for me, but I read a lot.

My thread is simple, to be short I just use Indy (IdHTTP) to GET the content of a web page and then I verify if the content contains a string. No problems here.

Now, to terminate threads I use a boolean with WHILE DO. It seems working but here is the problem : like I use a Timeout with Indy, sometimes I must wait the end of the timeout period before threads finish (when the server is not responding for example)…

It’s annoying, especially when I use +200 threads. With other softwares using multi-threads and similar procedure, when I click “Stop” all is stopped in few seconds, and that is what I need.

I read that I should use an AntiFreeze, to allow IdHTTP to “read my instuctions”…

So, I’m a bit lost here.
I don’t think it’s very necessary, but here is my code : http://pastebin.com/G7De8bgb

Thanks in advance for lights 🙂

Beny

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-30T16:55:05+00:00Added an answer on May 30, 2026 at 4:55 pm

    The class TidHTTP has an OnWork event. Use this event to cancel the data downloading or uploading. How to cancel with this event? Fire an Abort silent exception.

    This is a pseudo code:

    THTTPThread = class(TThread)
        private
            HTTPComponent: TidHTTP;
            procedure OnHTTPProgress(ASender: TObject; AWorkMode: TWorkMode;
                                         AWorkCount: Int64);
        published
            procedure execute();
    end;
    
    implementation
    procedure THTTPThread.execute;
    begin
        Self.HTTPComponent := TidHTTP.Create(nil);
        with HTTPComponent do
        begin
            OnWork := Self.OnHTTPProgress;
            Get('http://www.google.com');
        end;
    end;
    
    procedure THTTPThread.OnHTTPProgress(ASender: TObject; AWorkMode: TWorkMode;
      AWorkCount: Int64);
    begin
    
        if Self.Terminated then
            Abort;
    end;
    

    Take into account that the stages on which OnWork are called are random. The event could be called at the middle of the request, at the begging or even at the end. The code above will work as if you press the stop button on the browser.

    [UPDATE]
    Forget to mention that if then OnWork event is not called when the Thread is hanged out for a reply of the server, the use can use a timeout if the “last response” was received a specified milliseconds ago. Use GetTickCount for this.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I want to count how many characters a certain string has in PHP, but
I have a French site that I want to parse, but am running into
We're building an app, our first using Rails 3, and we're having to build
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
I need to clean up various Word 'smart' characters in user input, including but
I have a text area in my form which accepts all possible characters from
Seemingly simple, but I cannot find anything relevant on the web. What is the
I want to construct a data frame in an Rcpp function, but when I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.