Newsgroups : Borland : borland.public.delphi.internet.winsock : 2008 Jan : Re: Is it wise to use two TIdTCPClient compnents in an application?

www.cryer.info
Managed Newsgroup Archive

Re: Is it wise to use two TIdTCPClient compnents in an application?

Subject:Re: Is it wise to use two TIdTCPClient compnents in an application?
Posted by:"Martin James" (nospam@tuthill.com)
Date:Mon, 14 Jan 2008 07:41:52

I have used dozens of TidTCPClients, (and its descendants like TidHTTP),
without any problems.   I usually create them in the constructor of a
TThread class that calls the read methods.  I would be, (very, very), wary
of plonking lots of  TidCTPClients onto a form and relying on TidAntiFreeze
or any other 'one thread' method with Indy clients, ( in fact, I have never
used TidAntiFreeze at all).

If your protocol works by very occasionally polling clients, you can use the
read timeout to send the poll to the client and then loop back around to the
read method again to get the reply, check it etc.  A 'replyExpected' flag,
set after every poll and cleared when any reply is received, could be used
to indicate comms fail.  If you need the reply result, (or error message),
in the main thread, use some synchro method like synchronize, TidNotify or
PostMessage: with your loading, use any sync method - they are all fast
enough <g>.

Rgds,
Martin

Replies:

In response to:

www.cryer.info
Managed Newsgroup Archive