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. |
In reply to Re: Win32::Daemon + socket->accept: service cannot be stopped
by Jenda
in thread Win32::Daemon + socket->accept: service cannot be stopped [SOLVED]
by svenXY
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |