Newsgroups : Borland : borland.public.delphi.internet.winsock : 2008 Mar : Re: How to limit number of concurrent clients in TServerSocket?
| Subject: | Re: How to limit number of concurrent clients in TServerSocket? |
| Posted by: | "Bo Berglund" (bo.berglu..@telia.com) |
| Date: | Wed, 26 Mar 2008 22:46:30 |
On Wed, 26 Mar 2008 22:07:45 +0100, Bo Berglund
<bo.berglund@telia.com> wrote:
My focus has now shifted to finding out why the activeconnections do
not reflect the expected state.
In the communications object that is created on a client connect the
socket communications is handled via the two event handlers
OnSocketEvent and OnErrorEvent assigned to the supplied socket.
When the disconnect is detected in the OnSocketEvent I have now
enabled a timer with a short 50 ms timeout. In the OnTimer event of
the timer I do the following:
procedure TSSRemoteClientComm.OnCloseTimer(Sender: TObject);
begin
FCloseTimer.Enabled := false;
FSocket.OnSocketEvent := NIL;
FSocket.OnErrorEvent := NIL;
FSocket.Close;
Self.Free;
end;
Now I have gotten rid of the eternal loop problem causing server
lockup, but unfortunately when I do a few disconnect - connect -
disconnect - connect - disconnect cycles I see a monotonically
increasing number of "Active connections".
What is causing this?
/BoB