On Apr 20, 2012, at 2:53 AM, Raphael Bauduin wrote:

> Hi,
> 
> I need a process to send a request to a server, and wait a maximum of
> (let's say) 300 milliseconds. If no reply comes in this time span, a
> default action should be taken.
> 
> Is using a poller the only solution to this? I'm using the ruby
> bindings (rbzmq), and didn't see any reference to pollers in the rdoc.

Yes, you need to use zmq_poll. Take a look at the Ruby FFI bindings (ffi-rzmq 
gem) and look at the examples. There is at least one showing how to use the 
poller.

And don't worry about FFI being slow. It has gotten a lot of optimization 
attention from both the JRuby and Rubinius projects. The maintainer of the 
'ffi' gem for JRuby also maintains it for MRI. In my benchmarking, FFI adds 
about 1 microsecond of overhead on each call.

cr

_______________________________________________
zeromq-dev mailing list
[email protected]
http://lists.zeromq.org/mailman/listinfo/zeromq-dev

Reply via email to