From: ts Date: 2001-01-21T18:53:39+09:00 Subject: [ruby-talk:9641] Re: Non-blocking I/O? >>>>> "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 begin s = f.sysread(4); puts "-> Reading" puts s rescue IO::EOFError puts "-> Sleeping" sleep(5) end M> Yes, thanks. I tried to find that thread, but without success. I M> wouldn't be able to read it in japanese anyway... You have a translator, see http://www.ruby-lang.org/en/ml.html#japanlist Guy Decoux