代码之家  ›  专栏  ›  技术社区  ›  Frantic

使用Indy的代理服务器

  •  14
  • Frantic  · 技术社区  · 15 年前

    我想做以下工作:

    [client connection] := AContext.Connection
    read host/port from [client connection]
    [remote connection] := connect to host/port
    while both connections alive:
      if data available in [client connection]:
        read data from [client connection]
        write data to [remote connection]
      if data available in [remote connection]:
        read data from [remote connection]
        write data to [client connection]
    

    IOHandler 与之相关的财产。求求你,救命。

    我用的是Delphi2010的Indy。

    1 回复  |  直到 14 年前
        1
  •  20
  •   Remy Lebeau    15 年前

    Indy有自己的代理组件,可以满足您的要求。看看 TIdMappedPortTCP TIdHTTPProxyServer 组件作为起始位置。

    TIdMappedPortTCP OnConnect 事件动态配置该连接的目标主机/端口(例如从客户端读取),或者可以设置其 MappedHost MappedPort OnExecute OnOutboundData

    TIdHTTPProxyServer服务器 是仅用于基于HTTP的代理的专用代理,其中客户端使用HTTP GET POST , HEAD ,和 CONNECT 连接

    推荐文章