Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

running out of file descriptors using POE (code)

by deprecated (Priest)
on Dec 07, 2001 at 00:45 UTC ( [id://130062]=perlquestion: print w/replies, xml ) Need Help??

deprecated has asked for the wisdom of the Perl Monks concerning the following question:

I'm writing a napster server in perl using POE. I keep running out of files at around 256. I know how I would increase this in the C based napster server, does anyone know how I can do this in perl?

Thanks
bro dep

--
Laziness, Impatience, Hubris, and Generosity.

  • Comment on running out of file descriptors using POE (code)

Replies are listed 'Best First'.
Re: running out of file descriptors using POE (code)
by archimago (Pilgrim) on Dec 07, 2001 at 03:07 UTC
    #!/usr/bin/perl -w use strict; use POE::Me; use Lawyer::Bot; use RIAA::Magnet; if ($file_descriptors < $num_cease_desist_letters) { foreach my $lawyer (@firm) { $lawyer_fee = ($file_descriptors * $num_cease_desist_letters) +* 24 * 7 * 365); } system("rm -rf $wallet") && die; }
      nice.. us monks always appreciate smartass code.. =) -- SyBase
Re: running out of file descriptors using POE (code)
by jaldhar (Vicar) on Dec 07, 2001 at 03:08 UTC

    I'm assuming you're running some sort of UNIX here. There's a CPAN module BSD::Resource that allows perl to access the setrlimit(2) system call. This can be used to increase the number of file descriptors your process can open.

Re (tilly) 1: running out of file descriptors using POE (code)
by tilly (Archbishop) on Dec 07, 2001 at 09:26 UTC
Re: running out of file descriptors using POE (code)
by DrManhattan (Chaplain) on Dec 08, 2001 at 20:23 UTC
    What operating system are you running? Most OS's allow you to redefine resource limits on the fly. It's possible you're running into a hard limit though, and you'll have to recompile your kernel to adjust it.

    -Matt

Re: running out of file descriptors using POE (code)
by NicS (Scribe) on Dec 09, 2001 at 06:51 UTC
    You could try using ulimit -n to set this value higher before starting the perl script.
    That is assuming perl doesn't play around with this limit using setrlimit(2), this I am not sure of....


    --

    Nic

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://130062]
Approved by root
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others avoiding work at the Monastery: (6)
As of 2024-04-18 01:18 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found