【问题标题】:Can i use IdHTTP in the OnExecute Event (Indy)?我可以在 OnExecute 事件(Indy)中使用 IdHTTP 吗?
【发布时间】:2010-08-13 09:43:59
【问题描述】:

我可以在 OnExecute 事件 (Indy) 中使用 IdHTTP 吗?像这样:

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;

谢谢

【问题讨论】:

  • 我怀疑是这样。那么“数据”是您正在执行“获取”的网址吗?

标签: delphi indy


【解决方案1】:

是的。试试看吧。

【讨论】:

    猜你喜欢
    • 2011-04-02
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-07-27
    • 1970-01-01
    • 2012-01-09
    • 2018-11-24
    • 1970-01-01
    相关资源
    最近更新 更多