Peter, I've had the same issue for years, but never spent much time trying to solve it. Mainly because the services I wrote were all internal services, and all under my control, and I just keep it in mind when stopping them.
If you find an answer, can you post it? One thing I always meant to try but didn't get around to, was setting a global variable "StillExecuting" to true in the beginning of the Execute event, and then setting it to false as the last line in the Execute event. Then, setup a loop in the "OnStop" event that called ReportStatus, and then checked the state of the "StillExecuting" value. Sincerely, Brad Gies ------------------------------------- NLM Software Southfield, MI, USA ------------------------------------- Life isn't measured by the number of breaths we take, but by the moments that take our breath away. > -----Original Message----- > From: [EMAIL PROTECTED] [mailto:delphi-talk- > [EMAIL PROTECTED] On Behalf Of Peter Laman > Sent: Thursday, August 24, 2006 3:19 AM > To: Delphi Talk > Subject: //Stopping a service > > Hello, > > I have a Service Application (written in D6) that performs network > operations over a socket connection (using Indy) that can be quite > lengthy. > As a result, it can take a long time to stop the service. The Service > Control Manager however, is not very patient and promptly issues a > "Service > does not respond to the control function" message. After this, the service > ends up in some unclear, uncontrollable state. > I can avoid this timeout by setting the status property of the service to > csStopped in the OnStop handler before waiting for all operations to be > completed. But then I'm actually fooling the user by telling him he > stopped > the service, which is not yet true. > > Is there a better solution? > > Peter Laman > Senior Software Engineer > Lance ICT Group > Roermond, the Netherlands > http://www.lance-safety.com > - > "A person is as young as his dreams and as old as his cynicysm" - Tony > Campolo. > > __________________________________________________ > Delphi-Talk mailing list -> Delphi-Talk@elists.org > http://www.elists.org/mailman/listinfo/delphi-talk This e-mail or communication, including any attachments, is intended only for the person or entity to which it is addressed and may contain confidential and/or legally privileged material. Any review, retransmission, dissemination or other use of, or taking of any action in reliance upon, this information by persons or entities other than the intended recipient is prohibited. If you received this message in error, please contact the sender immediately and permanently delete all copies, electronic or other, you may have or from your computer. Any disclosure, copying, distribution, reliance or use of the contents or information received in error is strictly prohibited. The foregoing applies even if this notice is imbedded in a message that is forwarded or attached. __________________________________________________ Delphi-Talk mailing list -> Delphi-Talk@elists.org http://www.elists.org/mailman/listinfo/delphi-talk