note
Roger
Have a look at the module [cpan://Net::Server], it has pretty much all you need to write a network server daemon.<br><br>
Should you want to kill your daemon cleanly, create a signal handler in the daemon that does a graceful shutdown, and have the program, when you run with '-k' flag, to send a signal to the daemon, which then initiates the shutdown procedure.<br><br>
You may also want to look at modules like [cpan://Unix::Process] (really just ps -ef) to discover the PID of the daemon process.<br><br>
You can also create a /var/lock/myserver.lock file as well when the server first goes TSR, that contains the PID of the server process. The program later (in kill mode) will read this file to get the PID, validate the PID using [cpan://Unix::Process] to make sure it is still running, then send the kill signal to the server to initiate a clean shutdown.<br><br>
485331
485331