How to interrupt a lengthy database-retrieval using TIdHTTP

Giganews Newsgroups
Subject: How to interrupt a lengthy database-retrieval using TIdHTTP
Posted by:  Staffan Bergbom (Staffan.Bergb…@lm.se)
Date: Fri, 29 Apr 2005

Hi all,

Could someony tell me how I could interrupt a lengthy database-retrieval in
an app
where I use TIdHttp like in the following code:

function TfrmHttp.GetAddressAndCoordinates(ClientId, City, SearchAddress :
string) : string;
var
  IdHTTP1: TIdHTTP;
  request : string;
begin
  try
    IdHTTP1 := TIdHTTP.Create(Self);

    request := FAddressSearchURL + '/' +
        'GetAddressAndCoordinates?ClientId=' + ClientId + '&Database=' +
FDatabase +
        '&prm1=' + City + '&prm2=' + SearchAddress;
    try
      Result := IdHTTP1.Get(request); // Here I would like to be able to
interrupt if data-fetch takes to long
    except
    end;
  finally
    FreeAndNil(IdHTTP1);
  end;
end;

Regards
Staffan

Replies