I do speak to my kid, but it does not listen ;-(
Nothing arrives there.
The problem here is, that what should be send coems once and a while, while the kid should send, what it has got exactly every minute.
So I am forking a kid to sleep until full minute and then I want to read what has come and send it, but the can_read(0) returns always an empty array..
this is the fork and the parent-talk
The Kid executes thismy $pid = open(PIP, "|-");# open to write if ( !$pid ) { # I'm the child sendToClient( $SOCKET ); # give the Socket =ok exit; } else { # I'm parent talking to the kid print PIP "Are you there?\n"; my $n = 0; while (1) { # just to test.. print PIP "hmm, No. ",++$n,"\n"; # kid ?? print "hmm, No. $n\n"; sleep 1;#control -> ok! }
But @lines is allways empty - why && how to change?sub sendToClient { my $SOC = ( shift ); my $HDL = IO::Select->new( \*STDIN ); while ( $HDL->exists( \*STDIN ) ){ # ok! mySleepToFullMinute(); # ok, not the problem my @lines = $HDL->can_read( 0 ); # allways empty??? foreach my $l (@lines) { print $SOC $l; # nothing to send?? } } }
In reply to forked kid can't read from IO::Select->can_read by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |