tags:

views:

49

answers:

1

Hi , Can i use IdHTTP in the OnExecute Event (Indy) ? like this :

procedure TForm1.IdTCPServer1Execute(AContext: TIdContext);
var
  H: TIdHTTP;
  Data, Res: string;
begin
  Data := AContext.Connection.IOHandler.ReadLn();
  H := TIdHTTP.Create(nil);
  try
    Res := H.Get(Data);
  finally
    H.Free;
  end;
  AContext.Connection.IOHandler.WriteLn(Res);
end;

Thank you

+1  A: 

Yes. Just try it.

mjustin