I am using select with a TCP server. I want to add STDIN to the descriptor set of the selected file.
use IO::Select;
use IO::Socket::INET;
my $sock = IO::Socket::INET->new(LocalPort => $serv_listen_port, Proto => 'tcp', List en=> 1);
my $s = IO::Select->new();
$s->add(\*STDIN);
$s->add($sock);
@readytoread=$s->can_read(1);
foreach $readable (@readytoread) {
if ($readable==$sock) {
}
if ($readable == STDIN){
}
}
Need help from 4th to last line in code here.
source
share