>>>>> "Hildo" == Hildo Biersma <[EMAIL PROTECTED]> writes:
Hildo> What I would like to do is catch the condition that I am getting close Hildo> to running out of file descriptors, and then close all those client fds Hildo> that are idle. I realize I'll have to keep a data structure of idle Hildo> client connections; what I don't know is how to properly hook into POE Hildo> to count the number of current open fds (across all ports that POE Hildo> listens to). Where and how can I cleanly do this? I can hook into the Hildo> 'Acceptor' of the POE::Component::Server::TCP class, but don't see a Hildo> corresponding callback to track all connection close events. ANd it Hildo> would be nice not to have to count fds myself :-) You could have a 10-second "heartbeat" that does: my $first_free = do { open my $x, ">&STDERR"; fileno $x }; That will tell you the fd number of the first free file descriptor. You can then adjust your timeout value to be inversely proportionate to that number. Yes, it's not the same as the number currently in use, but it's a cheap number to get. -- Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095 <[EMAIL PROTECTED]> <URL:http://www.stonehenge.com/merlyn/> Perl/Unix/security consulting, Technical writing, Comedy, etc. etc. See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!