Newsgroups : Borland : borland.public.delphi.internet.winsock : 2007 Jun : Count active threads in TIdTCPServer?

www.cryer.info
Managed Newsgroup Archive

Count active threads in TIdTCPServer?

Subject:Count active threads in TIdTCPServer?
Posted by:"Mark Huebner" (mhuebn..@bostwicklaboratories.com)
Date:Wed, 27 Jun 2007 15:56:13

I'm creating a Windows service that uses Indy's TIdTCPServer and
TIdTCPClient.  TIdTCPServer and TIdTCPClient are configured to use different
IP addresses.

My TIdTCPServerExecute(AThread: TIdPeerThread) method processes incoming
messages and sends out ACK's and NAK's to a medical instrument over our
company network.  The communication is half-duplex.  Only one side can talk
at a time.  When there are no incoming messages being processed, I want my
application to send one or more messages to the medical instrument using
TIdTCPClient.  This will involve sending a message and receiving an ACK or
NAK from the medical instrument.

I'm assuming that I have to stop the TIdTCPServer from listening
(TIdTCPServer.Active:=false) before I startup the Client with
TIdTCPClient.Connect().  However, I don't see a  TIdTCPServer property that
tells me that the TIdTCPServer is inactive (no active threads).  Is there a
way to tell that TIdTCPServer has no active threads processing incoming
messages?  I don't want to set TIdTCPServer.Active to false until all the
active server threads have finished.

Replies:

www.cryer.info
Managed Newsgroup Archive