title: Proxy server using Indy
body: <p>I'm new to Indy and I want to build a simple proxy-server with it. This is a quite big library, and I just don't know where to start. When client connects to server, OnExucute fires up and receives client connection as parameter (AContext.Connection).</p>
  
  <p>I want to do following:</p>
  
  <pre><code>[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]
  </code></pre>
  
  <p>The question is what functions should I use for that? There is <code>IOHandler</code> property in Connection object with tons of them. Please, help.</p>
  
  <p>I'm using Indy that ships with Delphi2010.</p>