Making "tunnel" client-server application (Indy 10)

Giganews Newsgroups
Subject: Making "tunnel" client-server application (Indy 10)
Posted by:  mirko (mirkobel…@gmail.com)
Date: Tue, 15 Aug 2006

Hello,

I shall have to build some kind of gateway application using Indy 10 library.
Below is the simple scheme that represents it's purpose.
This application is more like tunnel, where all outgoing tunnel data
is based on received server data, and vice versa.
When the data arrives to one side, new data must be rapidly sent to other side.
Server side is LAN, tunnel is DSL. Traffic is very high on both sides,
so the app must be very fast and well organized.

As for supposed code, have it only like this now:

TIdTCPServer.OnExecute                  TTimer.OnTimer
  ...                                    ...
  NewData:=GenerateNewData(RcvData);      NewData:=GenerateNewData(RcvData);
  TIdTCPClient.Write(NewData);            TIdTCPServer.Contexts.LockList.Items[x].Write(NewData)
  ...                                    ...

Of course it is most likely that there is many problems in such code.
So could anyone provide me with appropriate code examples?
I'm looking for your advices and some guideline on how to better build described application.

-----------------------------------------------------------------------------

        Application

    +-------+  +-----+
    |    [C]<==>|    |
    |    . |  |    |
LAN | SRV . |  | CLI | DSL
    |    . |  |    |
    |    [C]<==>|    |
    +-------+  +-----+

          Scenario:
[LAN]
      -Server connection C received data
      -Forming new OutBuffer based on received data
      -Sending OutBuffer over CLI connection

[DSL]
      -CLI connection receives data_c
      -Forming new OutBuffer based on data_c
      -Sending OutBuffer over server connection implicitly defined in data_c
-----------------------------------------------------------------------------

Replies