in reply to Timing-out network clients?
IO::Socket::INET's timeout method (or the Timeout hash-param to the constructor) won't do what you want here. That timeout value corresponds to how long the socket should wait for acknowledgment from the peer when it has sent data (or is trying to connect).
I recommend putting the listening socket into an IO::Select object, then adding calls to Timer::HiRes::usleep in your while loop.
You definitely do need some sort of "global timer". You're forking, so it's probably as simple as:
- recording the PID of the child in a hash, along with the start time
- noting when the child process should no longer be around,
- sending the KILL signal to the child process.
I recommend putting the listening socket into an IO::Select object, then adding calls to Timer::HiRes::usleep in your while loop.
-David
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: Timing-out network clients?
by pascaldee (Acolyte) on Dec 05, 2007 at 07:12 UTC |
In Section
Seekers of Perl Wisdom