Newsgroups : Borland : borland.public.delphi.internet.winsock : 2007 Dec : Re: How to stop a Tid(Cmd)TCPServer while clients are connected?

www.cryer.info
Managed Newsgroup Archive

Re: How to stop a Tid(Cmd)TCPServer while clients are connected?

Subject:Re: How to stop a Tid(Cmd)TCPServer while clients are connected?
Posted by:"Remy Lebeau (TeamB)" (no.spam@no.spam.com)
Date:Tue, 4 Dec 2007 09:56:31

"Chris Ueberall" <CUeberall@web.de> wrote in message
news:47555fbf$1@newsgroups.borland.com...

> I tried several methods to stop a TCPServer while a client
> is connected, but without success, the server always hangs
> then.

Then your event handler code is likely deadlocking itself.  Are you
performing any synchronized operations?

> a) myIdCmdTCPServer.Active := False;

That is all you need to do to stop the server..

> b) myIdCmdTCPServer.StopListening;

Do not do that.

> c) closing all sockets of every connection first didn't help too.

The Active property's setter method does that internally for you.


Gambit

Replies:

In response to:

www.cryer.info
Managed Newsgroup Archive