Unfortunately, the tutorial is pretty much useless for a win32 user as

  1. select doesn't work on file-handles under win32.

    I've also wondered what happens (under *nix) if you call can_read() on a file handle connected to a file that is being written to by another process (as when tailing a file), if some new data has been written (and could therefore be read), but not enough has been written to satisfy the number of characters requested in the sysread?

    Does sysread return immediately with just that number of characters as are available, or does it block indefinitely waiting until it can satisfy the full read request?

  2. The discussion is incomplete with respect to using select on sockets, as it does not discuss blocking. Specifically setting sockets non-blocking.

    Again, if a (blocking) socket has received some data before the timeout, but not enough to satisfy the number specified on the sysread, can_read() will have returned true, but will sysread block or not?

    It's also the case that using the blocking => 1 parameter to IO::Socket->new() also does not work under win32. Whilst it is possible to set Win32 sockets non-blocking, and the means is discussed here at PM, the details are somewhat shrouded in mystery and are not discussed or even mentioned in any of the Perl docs.


Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.
"Too many [] have been sedated by an oppressive environment of political correctness and risk aversion."

In reply to Re^6: How to make sysread timeout by BrowserUk
in thread How to make sysread timeout by redss

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.