Module: ZMQ

Defined in:
lib/ffi-rzmq.rb,
lib/ffi-rzmq/poll.rb,
lib/ffi-rzmq/util.rb,
lib/ffi-rzmq/device.rb,
lib/ffi-rzmq/libzmq.rb,
lib/ffi-rzmq/socket.rb,
lib/ffi-rzmq/context.rb,
lib/ffi-rzmq/message.rb,
lib/ffi-rzmq/version.rb,
lib/ffi-rzmq/constants.rb,
lib/ffi-rzmq/constants.rb,
lib/ffi-rzmq/constants.rb,
lib/ffi-rzmq/exceptions.rb,
lib/ffi-rzmq/poll_items.rb

Defined Under Namespace

Modules: CommonSocketBehavior, IdentitySupport, LibZMQ, Util Classes: Context, ContextError, Device, ManagedMessage, Message, MessageError, PollItems, Poller, Socket, ZeroMQError

Constant Summary collapse

LIBPATH =

:stopdoc:

::File.expand_path(::File.dirname(__FILE__)) + ::File::SEPARATOR
PATH =
::File.dirname(LIBPATH) + ::File::SEPARATOR
VERSION =
"0.9.3"
PAIR =

Socket types

0
PUB =
1
SUB =
2
REQ =
3
REP =
4
XREQ =
5
XREP =
6
PULL =
7
PUSH =
8
SocketTypeNameMap =
{
  PAIR => "PAIR",
  PUB => "PUB",
  SUB => "SUB",
  REQ => "REQ",
  REP => "REP",
  PULL => "PULL",
  PUSH => "PUSH",
  XREQ => "XREQ",
  XREP => "XREP"
}
AFFINITY =

Socket options

4
SUBSCRIBE =
6
UNSUBSCRIBE =
7
RATE =
8
RECOVERY_IVL =
9
SNDBUF =
11
RCVBUF =
12
RCVMORE =
13
FD =
14
EVENTS =
15
TYPE =
16
LINGER =
17
RECONNECT_IVL =
18
BACKLOG =
19
RECONNECT_IVL_MAX =
21
SNDMORE =

Send/recv options

2
POLL =

I/O multiplexing

1
POLLIN =
1
POLLOUT =
2
POLLERR =
4
EAGAIN =

Socket errors

Errno::EAGAIN::Errno
EINVAL =
Errno::EINVAL::Errno
ENOMEM =
Errno::ENOMEM::Errno
ENODEV =
Errno::ENODEV::Errno
EFAULT =
Errno::EFAULT::Errno
HAUSNUMERO =

ZMQ errors

156384712
EMTHREAD =
(HAUSNUMERO + 50)
EFSM =
(HAUSNUMERO + 51)
ENOCOMPATPROTO =
(HAUSNUMERO + 52)
ETERM =
(HAUSNUMERO + 53)
ENOTSUP =

Rescue unknown constants and use the ZeroMQ defined values Usually only happens on Windows though some don’t resolve on OSX too (ENOTSUP)

Errno::ENOTSUP::Errno rescue (HAUSNUMERO + 1)
EPROTONOSUPPORT =
Errno::EPROTONOSUPPORT::Errno rescue (HAUSNUMERO + 2)
ENOBUFS =
Errno::ENOBUFS::Errno rescue (HAUSNUMERO + 3)
ENETDOWN =
Errno::ENETDOWN::Errno rescue (HAUSNUMERO + 4)
EADDRINUSE =
Errno::EADDRINUSE::Errno rescue (HAUSNUMERO + 5)
EADDRNOTAVAIL =
Errno::EADDRNOTAVAIL::Errno rescue (HAUSNUMERO + 6)
ECONNREFUSED =
Errno::ECONNREFUSED::Errno rescue (HAUSNUMERO + 7)
EINPROGRESS =
Errno::EINPROGRESS::Errno rescue (HAUSNUMERO + 8)
ENOTSOCK =
Errno::ENOTSOCK::Errno rescue (HAUSNUMERO + 9)
EINTR =
Errno::EINTR::Errno rescue (HAUSNUMERO + 10)
UPSTREAM =

Socket types

PULL
DOWNSTREAM =
PUSH
DEALER =
XREQ
ROUTER =
XREP
STREAMER =

Device Types

1
FORWARDER =
2
QUEUE =
3
HWM =

Socket options

1
IDENTITY =

Socket options

5
MCAST_LOOP =
10
SWAP =
3
RECOVERY_IVL_MSEC =
20
NOBLOCK =

Send/recv options

1
XPUB =

Socket types

9
XSUB =
10
MAXMSGSIZE =
22
SNDHWM =
23
RCVHWM =
24
MULTICAST_HOPS =
25
RCVTIMEO =
27
SNDTIMEO =
28
DONTWAIT =

Send/recv options

1
SNDLABEL =
4
EMFILE =

Socket & other errors

Errno::EMFILE::Errno

Class Method Summary collapse

Class Method Details

.libpath(*args, &block) ⇒ Object

Returns the library path for the module. If any arguments are given, they will be joined to the end of the libray path using File.join.



19
20
21
22
23
24
25
26
27
28
29
30
# File 'lib/ffi-rzmq.rb', line 19

def self.libpath( *args, &block )
  rv =  args.empty? ? LIBPATH : ::File.join(LIBPATH, args.flatten)
  if block
    begin
      $LOAD_PATH.unshift LIBPATH
      rv = block.call
    ensure
      $LOAD_PATH.shift
    end
  end
  return rv
end

.path(*args, &block) ⇒ Object

Returns the lpath for the module. If any arguments are given, they will be joined to the end of the path using File.join.



36
37
38
39
40
41
42
43
44
45
46
47
# File 'lib/ffi-rzmq.rb', line 36

def self.path( *args, &block )
  rv = args.empty? ? PATH : ::File.join(PATH, args.flatten)
  if block
    begin
      $LOAD_PATH.unshift PATH
      rv = block.call
    ensure
      $LOAD_PATH.shift
    end
  end
  return rv
end

.require_all_libs_relative_to(fname, dir = nil) ⇒ Object

Utility method used to require all files ending in .rb that lie in the directory below this file that has the same name as the filename passed in. Optionally, a specific directory name can be passed in such that the filename does not have to be equivalent to the directory.



54
55
56
57
58
59
60
# File 'lib/ffi-rzmq.rb', line 54

def self.require_all_libs_relative_to( fname, dir = nil )
  dir ||= ::File.basename(fname, '.*')
  search_me = ::File.expand_path(
  ::File.join(::File.dirname(fname), dir, '**', '*.rb'))

  Dir.glob(search_me).sort.each {|rb| require rb}
end

.versionObject

Returns the version string for the library.



11
12
13
# File 'lib/ffi-rzmq.rb', line 11

def self.version
  @version ||= File.read(path('version.txt')).strip
end