Re: HTTPServer # of Threads

Giganews Newsgroups
Subject: Re: HTTPServer # of Threads
Posted by:  Remy Lebeau (TeamB) (gambit47.no.spam@no.spam.yahoo.com)
Date: Thu, 30 Oct 2003

"steve" <csufsurf…@yahoo.com> wrote in message
news:9D10C41DA284E240csufsurf…@yahoo.com...
> I'm trying to figure out how many threads are currently
> executing on a server at a given time.  I figured it would be
> in IdHTTPServer1.ThreadMgr.ActiveThreads  but I can't
> find a Count property.

ActiveThreads is a TThreadList.  You have to call LockList() first in order
to access the actual list:

    var
        iCount: Integer;
        pList: TList;

    with IdHTTPServer1.ThreadMgr.ActiveThreads do
    begin
        pList := LockList;
        iCount := pList.Count;
        UnlockList;
    end;

    // use iCount as needed

> I did see IdHTTPServer1.Bindings.Count but that number
> stayed at 1 when I had multiple client connections.

As it should.  There is a Binding for each IP/Port combo that the server is
listening on, that does not change while the server is still active.

> I'm not familiar with Bindings but it seems that it has more to do
> with the socket information that it is bound to not the clients that
> connect to it.

Correct.

Gambit

Replies

In response to

HTTPServer # of Threads posted by steve on Thu, 30 Oct 2003