It is necessary to implement a constant download page from the site. There is a component IdHTTTP from him method Get gets the page. I tried to loop the program in such a way, it should work, not work ... using WorkEnd events (after the page loads)

procedure TForm12.IdHTTP1WorkEnd(ASender:TObject; AWorkMode: TWorkMode); begin memo1.Lines.Add('ADD'); idHTTP1.Get('http://yandex.ru'); end; 

It looks like recursion, but not quite), and so, it is executed only once, although after loading the page, the WorkEnd event again triggers Get ... loading and waiting for WorkEnd to fire, but it does not work anymore, why?

    1 answer 1

    You have a dead-lock because of the recursion. Your connection cannot close. And the new cannot open, because the previous has not closed.

    As an option (I do not know why this is necessary, is it true - are you waiting for a ban from Yandex?) Hang the get call on the timer. In OnWorkBegin put a flag that the request is coming. In OnWorkEnd shoot. The timer will check this flag and if cleared, run get again.

    • Option, I think the timer for 500ms is suitable, just the Internet is very weak. And about Yandex, for example, there will be a website (educational institution). - Man