Article View: borland.public.cppbuilder.internet.socket
Article #1050Re: Indy 10 application design
From: Bob Gonder
Date: Mon, 11 Jun 2007 16:00
Date: Mon, 11 Jun 2007 16:00
45 lines
2873 bytes
2873 bytes
Old Wolf wrote: >I am using Indy 10 that came with BDS2006, in C++. That version is quite old. You should probably download the latest version as Remy has done a hellalota work on it in the 1.7 years since BDS came out. >My application accepts multiple connections on a TIdTCPServer >and re-routes them all on the same TIdTCPClient connection, >then listens for responses and sends them back to where the >initial request came from. Ok, so you are a "concentrator" or "front-end controller" >I have managed to write an OnExecute handler for the >TIdTCPServer so that inbound packets can be read, and then >call IdTCPClient1->Socket->Send to send it on upstream. Is >IdTCPClient thread-safe or do I need some extra protection >in here? I wouldn't think it is. I think you need to serialize access to the single (client) pipe. How do you handle routing the return response? Is it one question, one response, next question? No interleaving? Or does the return contain an ID that lets you route it? I would think a ReadThread and a WriteThread for Client. Server adds questions to WriteThread's fifo queue. WriteThread serially forwards the requests over Client connection to mainframe. Mainframe returns data to Client connection's ReadThread which forwards them by writing to the Server, and thence to the user. Each user has their own Server socket, so there should be no contention there. Then, if you have throughput issues, bottlenecked in the ReadThread waiting to write to Server, you could add write queues and threads on the server side as well. >I have been able to read responses by setting up a TTimer >on the main form, and polling the IdTCPClient for incoming >messages. However I'm not sure if this is the recommended >strategy. No, I would not reccommend that.
Technical Details
Message-ID:
<jjqq63lfjbekvn7m0e65ls4dm4soc32peb@4ax.com>Path:
arc1-ca.pugleaf.net!g2news1.google.com!news3.google.com!feeder1-2.proxad.net!proxad.net!feeder1-1.proxad.net!club-internet.fr!feedme-small.clubint.net!newsfeed.freenet.de!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mailReferences:
<466cbb16$1@newsgroups.borland.com>Show Full Headers
Complete Article Headers
X-Google-Thread: 11508e,5214d7fac32891ae X-Google-Attributes: gid11508e,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit From: Bob Gonder <notbg@notmindspring.invalid> Newsgroups: borland.public.cppbuilder.internet.socket Subject: Re: Indy 10 application design Date: Mon, 11 Jun 2007 09:00:45 -0700 Organization: MindSpring Enterprises, Inc. Reply-To: notbg@notmindspring.invalid Message-ID: <jjqq63lfjbekvn7m0e65ls4dm4soc32peb@4ax.com> References: <466cbb16$1@newsgroups.borland.com> X-Newsreader: Forte Agent 1.93/32.576 English (American) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit NNTP-Posting-Host: 69.69.86.80 X-Trace: newsgroups.borland.com 1181577643 69.69.86.80 (11 Jun 2007 09:00:43 -0700) Lines: 47 Path: arc1-ca.pugleaf.net!g2news1.google.com!news3.google.com!feeder1-2.proxad.net!proxad.net!feeder1-1.proxad.net!club-internet.fr!feedme-small.clubint.net!newsfeed.freenet.de!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail