Adapting the SYNOPSIS gives me the following code:
use IO::Select; $s = IO::Select->new(); ... $s->add($some_handle); my $outbuffer; while( $running ) { if( length $outbuffer ) { my @writeable = $s->can_write($timeout); for my $client (@writeable) { print {$client} $outbuffer; # In reality, we'd need to maintain an outbuffer per c +lient, but # that's not the point here }; undef $outbuffer; } else { $outbuffer = refill_outbuffer; }; };
In reply to Re^7: Check connection state prior to send data
by Corion
in thread Check connection state prior to send data
by Lucas Rey
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |