TCPServer.Active=false (Indy10)

Giganews Newsgroups
Subject: TCPServer.Active=false (Indy10)
Posted by:  Inter-biz (in…@REMOVEinter-biz.hr)
Date: Wed, 24 Nov 2004

My program is running into a loop when setting TCPServer.Active to false in
FormDestroy event.
Prior to setting it to false, I have following code:

var Cont:TIdContext; i:integer;
begin

    for i:=TCPServer.Contexts.LockList.Count-1 downto 0 do
    begin
          Cont:=TIdContext(TCPServer.Contexts.LockList.Items[i]);
          Cont.Connection.Disconnect;
    end;
    TCPServer.Contexts.Clear;
    TCPServer.Contexts.UnLockList;

It should go through all connections, diconnect them and finally clear
Contexts list.
I cannot find any example, so could someone give proper advice?

Replies