Zarko Gajic <http://delphi.about.com> <delphi.guide.nos...@about.com>
wrote in message news:3e2ea41a$1@newsgroups.borland.com...
Quote
> So to sum things up:
> Use TCPServer (active) on each Client (no separate wait thread) and
connect
> as Client from Server as needed?
Well, I wouldn't do this at all. With only 25-30 clients, I see no
problem in just letting the clients connect to the server & keep the
connection open. This seems far simpler than running server
instances on each client, (to say nothing of resources used). To
talk to the client, the server would have to either create a client
instance as required or keep a queue of client instances, ready for
connection. This all starts to become very messy - far more complex
than one client-server connection and a read thread at each client.
There are some network scenarios where a complex solution is really
neccessary, but this doesn't seem to be one of them.
Instantiating a client component takes a significant amount of time -
so much that it is noticeable by humans. Opening a connection,
similarly, takes a huge amount of time, (in computer terms). Either
of these operations will sieze the calling thread for this time & the
latency in your communication will be very noticeable. This may, or
may not, be important to your app.
Another problem is that of connection management. The more
connections you have, the more difficult it is to control things.
It's bad enough keeping track of just one connection - see all the
posts regds 'onDisconnect not fired', 'How do I know if my client is
still there?', 'How do tell if the server has crashed?'.
If you have one connection, and keep it open, there is next to no
latency in communication. No socket components need to be
instantiated during normal communication bursts. There is no
connect-protocols continually being run. There is only one
server<>client connection to control & manage.
The downside is that you need a read-thread at the client & your
protocol needs to allow for the 'two-way' communication. I have
found this a small price to pay for reducing connection complexity.
Rgds,
Martin