Beefy Boxes and Bandwidth Generously Provided by pair Networks DiBona
Come for the quick hacks, stay for the epiphanies.
 
PerlMonks  

Re^4: New to perl: IO Select question :(

by CompleteMoron (Initiate)
on Aug 20, 2005 at 20:20 UTC ( [id://485451]=note: print w/replies, xml ) Need Help??

This is an archived low-energy page for bots and other anonmyous visitors. Please sign up if you are a human and want to interact.


in reply to Re^3: New to perl: IO Select question :(
in thread New to perl: IO Select question :(

Yup I'v seen that example, and tried it with can_read aswell, same thing happens :(
  • Comment on Re^4: New to perl: IO Select question :(

Replies are listed 'Best First'.
Re^5: New to perl: IO Select question :(
by Roger (Parson) on Aug 20, 2005 at 20:34 UTC
    my $sock = IO::Socket::INET->new( Proto=>"tcp", LocalHost=>"Localhost", Listen=>16, Reuse=>1, LocalPort=>$ARGV[0] ) or die("Could not create socket!\n") +; my $readSet = new IO::Select(); $readSet->add($sock); my $rhSet = IO::Select->select($readSet); while(my @ready = $rhSet->can_read(0)) { foreach $rh(@ready) { if($rh == $sock) { $newSocket=$rh->accept(); $readSet->add($newSocket); } else { $buf=<$rh>; if($buf) { printf "$buf"; } else { $readSet->remove($rh); close($rh); } } } }

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://485451]
help
Sections?
Information?
Find Nodes?
Leftovers?
    Notices?
    hippoepoptai's answer Re: how do I set a cookie and redirect was blessed by hippo!
    erzuuliAnonymous Monks are no longer allowed to use Super Search, due to an excessive use of this resource by robots.