It almost makes sense. select is supposed to tell you when a call won't block. Having the write fail instead of blocking, it makes sense that select needs to return (otherwise the select would just hang forever if you didn't give a timeout).
Reading the IO::Socket module, I was bit surprised that waiting for more than one condition type isn't easier. But anyway, I'd do this:
and see what happens. Then you have the error loop do recovery based on what behavior you see, etc.my $canWrite= IO::Select->new( $sock ); my $hasError= IO::Select->new( $sock ); my( $aWrite, $aError )= IO::Select->select( undef, $canWrite, $hasError ); for( @$aError ) { warn "Error on socket ($_).\n"; } for( @$aWrite ) { if( print $_ $message ) { print "message sent.\n"; } else { warn "Can't write to socket ($_): $!\n"; } }
In reply to Re: Stupid IO::select question
by tye
in thread Stupid IO::select question
by BlaisePascal
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |