lol. That's quite true.

Yes well I was tired. I also have to fix the rTime(), but that's not an issue (even though nobody pointed it out yet ; strangely).

My new code doesn't make things more complex, seems logical to me at least.

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); } } }
You see, I have decided that I would like to process a socket array of priority, instead of checking any read-ready socket array,
then immediately after that, check/process any write-ready socket array's no matter what the situation at that given time, IE:
while(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); } }
With the above. The else block within the @$ready processing loop seems to only get executed
after the 'TCP Handshake' occurs AND the client actually sends data.


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

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.