Hi there,
I'm searching for information about the select()-funktion in perl for weeks but I couldn't find anything except the manpage but there is really not enough information about select().
My question is: How can I find out if I can read from a filehandle or a socket wich select() watches?
Here is my code:
It seems to me that $nfound is always true, even if there is nothing to read on READSOCKET. So how do I know if I can read from READSOCKET?
Thank you very much for your answers.
I'm searching for information about the select()-funktion in perl for weeks but I couldn't find anything except the manpage but there is really not enough information about select().
My question is: How can I find out if I can read from a filehandle or a socket wich select() watches?
Here is my code:
Code:
while(1)
{
vec($rin,fileno(READSOCKET),1) = 1;
$ein = $rin;
($nfound, $timeleft) = select($rin, undef, $ein, 0);
if($nfound)
{
$input = '';
do
{
read(READSOCKET, $puffer, 1);
print $puffer;
}while(!($input =~ /<BR>/));
} elsif(!$nfound)
{
print "nothing happened\n";
}
}
close(READSOCKET);
It seems to me that $nfound is always true, even if there is nothing to read on READSOCKET. So how do I know if I can read from READSOCKET?
Thank you very much for your answers.