in reply to Re: Sockets and Fork, Please Help Me!!
in thread Sockets and Fork, Please Help Me!!
Secondly, if you know all your handles in advance you can just pass them to the IO::Select constructor rather than adding them one by one. And the can_read call can be incorporated directly into the loop condition. So maybe something like:
use strict; use IO::Select; my $s = IO::Select->new(\*STDIN, $telnet, $telnet2); while (my @ready = $s->can_read()) { for my $ready (@ready) { if ($ready == \*STDIN) { handle_stdin(); } else { handle_telnet($ready); } } }
|
|---|