Sam Duncan wrote in post #1036445:

> What happens if you set non-blocking on the socket and try to catch an
> exception on the recv?
>
> require 'fcntl'
> ...
>
> s = UDPSocket.new
>
> s.fcntl(Fcntl::F_SETFL, s.fcntl(Fcntl::F_GETFL) | Fcntl::O_NONBLOCK)
> ...
> begin
>
>    packet, from = s.recvfrom(2048,0)
>
> rescue StandardError => e
>    puts "Waarg: #{e}"
>    next
> end
> ...
>

Hi Sam -

Thanks for the help.

I am confused, because my program still blocks on the call to 
s.recvfrom().  I tossed a puts before and after the 's.recvfrom()' call 
and sure enough, it is still pausing for 5 seconds inside of the try 
block.  This in spite of the O_NONBLOCK.  And for sanity I did a few 
other printy things to be sure that my program is using the modified 
version of the library.

Is there any known goofiness to ruby 1.8.7's IO not working correctly? 
The behavior that I'm seeing seems really...odd.

Thanks again,
Reid

-- 
Posted via http://www.ruby-forum.com/.