You see, I have decided that I would like to process a socket array of priority, instead of checking any read-ready socket array,while(1) { my @priority_array; ($rready,$wready) = IO::Select->select($sel, $sel, undef); if(@$rready&&!@$wready) { # Let's process the read ready socket array. # As there are no writables yet @priority_array=@$rready; }elsif(@$rready&&@$wready) { # Let's process the read ready socket # # array before the write array # as a new socket/client has arrived @priority_array=@$rready; }else{ # Let's process the write ready socket array # this time. As no readables are ready @priority_array=@$wready; } foreach my $socket (@priority_array) { if($socket == $lsn) { new_socket($socket); }else{ # Let's actually generate those chars to # the client/socket # that is write ready gen_chars($socket); } } }
With the above. The else block within the @$ready processing loop seems to only get executedwhile(1) { ($rready,$wready) = IO::Select->select($sel, $sel, undef); foreach my $rsocket (@$rready) { if($rsocket == $lsn) { new_socket($rsocket); }else{ # whatever } } foreach my $wsocket (@$wready) { gen_chars($wsocket); } }
In reply to Re: chargen program is too slow / IO::Select socket handle outputting timing issue
by kabeldag
in thread chargen program is too slow / IO::Select socket handle outputting timing issue
by kabeldag
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |