From: Urabe Shyouhei Date: 2011-08-02T08:06:23+09:00 Subject: [ruby-core:38669] Re: [Ruby 1.9 - Bug #5138][Open] Add nonblocking IO that does not use exceptions for EOF and EWOULDBLOCK (08/02/2011 07:46 AM), Aaron Patterson wrote: > This seems very handy for read loops. Always rescuing the exception > bothered me. I think this would be very good functionality when writing > pure ruby servers. Well... the request is about nonblocking IO so I assume the "pure ruby server" you are talking about is single threaded. When you write such read loop, you normally use IO.select as follows: read_fds = [ fd1, fd2, ... ] loop do r, w, e = IO.select(read_fds) r.each do |f| str = f.readpartial # ..... (*) end end At the point marked with (*), the socket in question is returned from a select call, which means, the call to f.readpartial would not block because there must be something in a socket's buffer. So when you do a read loop, nothing bothers you, as long as you use readpartial.