From: schuerig@... (Michael Schuerig) Date: 2001-01-22T00:10:02+09:00 Subject: [ruby-talk:9658] Re: Non-blocking I/O? ts wrote: > >>>>> "M" == Michael Schuerig writes: > > M> Sounds good, but poses another problem: How to find out the number of > M> available bytes? If I call sysread with a number exceeding the number of > M> available bytes, it runs into EOF an throws an exception. Unix read(2) > M> behaves differently, it only reads at most the number of bytes specified > M> and returns the actual number read. > > #sysread use internally read(2). Just catch IO::EOFError Works, thanks. But I must admit, that I don't like using exceptions for control-flow. Michael -- Michael Schuerig mailto:schuerig@acm.org http://www.schuerig.de/michael/