module CZTop::ZsockOptions

This module adds the ability to access options of a {Socket} or an {Actor}.

@note Most socket options only take effect for subsequent bind/connects.

@see api.zeromq.org/4-1:zmq-setsockopt @see api.zeromq.org/4-1:zmq-getsockopt @see api.zeromq.org/czmq3-0:zsock-option

Public Instance Methods

fd() click to toggle source

Useful for registration in an event-loop. @return [Integer] @see OptionsAccessor#fd

# File lib/cztop/zsock_options.rb, line 35
def fd
  options.fd
end
options() click to toggle source

Access to the options of this socket. @return [OptionsAccessor] the memoized options accessor

# File lib/cztop/zsock_options.rb, line 14
def options
  @options ||= OptionsAccessor.new(self)
end
readable?() click to toggle source

Checks whether there's a message that can be read from the socket without blocking. @return [Boolean] whether the socket is readable

# File lib/cztop/zsock_options.rb, line 21
def readable?
  (options.events & Poller::ZMQ::POLLIN) > 0
end
writable?() click to toggle source

Checks whether at least one message can be written to the socket without blocking. @return [Boolean] whether the socket is writable

# File lib/cztop/zsock_options.rb, line 28
def writable?
  (options.events & Poller::ZMQ::POLLOUT) > 0
end