I'm having some problems with the Idhttp.Get method. I thought it's by default working in blocking-mode(wait for the answer to go to next line), but I just saw it's not waiting for the answer to go to another line. I'm using it with threads, but I think that's not the problem. The code is:
IdHTTP1:= TIdHttp.Create(Application);
IdHTTP1.ConnectTimeout:= 10000;
IdHTTP1.Request.Clear;
IdHTTP1.Request.BasicAuthentication:= true;
IdHTTP1.Request.Username := Username;
IdHTTP1.Request.Password := Password;
try
IdHTTP1.Get(PbxURL); **//this should STOP here and wait for answer don't?**
HttpCode:= IdHTTP1.ResponseCode;
except
on E: EIdHTTPProtocolException do
HttpCode := IdHTTP1.ResponseCode;
end;
if HttpCode=200 then
Memo1.Lines.Append('Valid Get!');
So, I just notice that i'm not getting the right HttpCode value because after the 'Get' method, it just continue the execution without waiting for the 'Get' complete. How can I solve this problem??