Newsgroups : Borland : borland.public.delphi.internet.winsock : 2008 Mar : Re: How to limit number of concurrent clients in TServerSocket?

www.cryer.info
Managed Newsgroup Archive

Re: How to limit number of concurrent clients in TServerSocket?

Subject:Re: How to limit number of concurrent clients in TServerSocket?
Posted by:"Remy Lebeau (TeamB)" (no.spam@no.spam.com)
Date:Wed, 26 Mar 2008 17:06:58

"Bo Berglund" <bo.berglund@telia.com> wrote in message
news:0mglu356ig3prh90g3g6eeknhnpldhp0bk@4ax.com...

> My focus has now shifted to finding out why the activeconnections
> do not reflect the expected state.

Because you are misusing the component.  See my other reply for a fix.

> 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.

That is the cause of your problem.  You need to change that, as I outlined
in my other reply.

> When the disconnect is detected in the OnSocketEvent I have now
> enabled a timer with a short 50 ms timeout.

You don't need the timer at all.  You need to get rid of your OnSocketEvent
and OnErrorEvent handlers altogether instead and let the TServerSocket
handle those events internally.  You are breaking the TServerSocket's
internal logic, that is why your code keeps failing.

> 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?

Your misuse of the component.  See my other reply.


Gambit

Replies:

none

In response to:

www.cryer.info
Managed Newsgroup Archive