in reply to Win32::Daemon + socket->accept: service cannot be stopped [SOLVED]
I don't know whether there is a way to make timeout the accept(), I would probably use two threads instead. One thread would do the work (call the accept() and wait for the commands), the other would respond to the Service Manager request. And if the Service Manager requests that the service stops the second thread would connect to the first one and issue a stop command.
This way the worker thread would not need to timeout the accept() it would just wait for a connection either from a client or the other thread. Since you do not need to share any data between the threads it's enough to use fork() to create the threads. Do I make sense?
P.S.: You may want to have a look at Win32::Daemon::Simple, that'd make the service related part of the script much much simpler.
Jenda
| XML sucks. Badly. SOAP on the other hand is the most powerfull vacuum pump ever invented. |
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Win32::Daemon + socket->accept: service cannot be stopped
by svenXY (Deacon) on Jun 24, 2005 at 09:01 UTC | |
by Jenda (Abbot) on Jun 24, 2005 at 14:18 UTC | |
by svenXY (Deacon) on Jun 27, 2005 at 08:45 UTC |