Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

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

by Roger (Parson)
on Aug 21, 2005 at 00:34 UTC ( [id://485454]=note: print w/replies, xml ) Need Help??


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

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://485454]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others admiring the Monastery: (2)
As of 2024-04-25 19:22 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found