How can I perform a nonblocking IO read?  That is, read whatever is
there to read and return.  If there's nothing yet, just return.

Failing that, is there a way to manually check if there's anything to
read or the read will block?

(Note that I'm developing for both 'nix and Windows.)