module ZMQ

Ruby interface to the zeromq messaging library.

Constants

AFFINITY
BACKLOG
DEALER
DOWNSTREAM
EVENTS
FD
HWM
IDENTITY
LINGER
MCAST_LOOP
NOBLOCK
PAIR
PUB
PULL
PUSH
RATE
RCVBUF
RCVMORE
RECONNECT_IVL
RECONNECT_IVL_MAX
RECOVERY_IVL
RECOVERY_IVL_MSEC
REP
REQ
ROUTER
SNDBUF
SNDMORE
SUB
SUBSCRIBE
SWAP
TYPE
UNSUBSCRIBE
UPSTREAM
XREP
XREQ

Public Class Methods

select(in, out=[], err=[], timeout=nil) → [in, out, err] | nil click to toggle source

Like IO.select, but also works with 0MQ sockets.

static VALUE module_select (int argc_, VALUE* argv_, VALUE self_)
{
    VALUE readset, writeset, errset, timeout;
    rb_scan_args (argc_, argv_, "13", &readset, &writeset, &errset, &timeout);

    long timeout_usec;

    if (!NIL_P (readset)) Check_Type (readset, T_ARRAY);
    if (!NIL_P (writeset)) Check_Type (writeset, T_ARRAY);
    if (!NIL_P (errset)) Check_Type (errset, T_ARRAY);
    
    if (NIL_P (timeout))
        timeout_usec = -1;
    else
        timeout_usec = (long)(NUM2DBL (timeout) * 1000000);

    return module_select_internal(readset, writeset, errset, timeout_usec);
}
version() → [major, minor, patch] click to toggle source

Returns the version of the zeromq library.

static VALUE module_version (VALUE self_)
{
    int major, minor, patch;
    
    zmq_version(&major, &minor, &patch);
    
    return rb_ary_new3 (3, INT2NUM (major), INT2NUM (minor), INT2NUM (patch));
}