Class: ZMQ::Socket::Pair

Inherits:
ZMQ::Socket show all
Defined in:
lib/zmq/socket/pair.rb,
ext/rbczmq/socket.c

Constant Summary collapse

TYPE_STR =

ZMQ::Socket::Pair

A socket of type ZMQ::Socket::Pair can only be connected to a single peer at any one time. No message routing or filtering is performed on messages sent over a ZMQ::Socket::Pair socket.

When a ZMQ::Socket::Pair socket enters an exceptional state due to having reached the high water mark for the connected peer, or if no peer is connected, then any ZMQ::Socket#send operations on the socket shall block until the peer becomes available for sending; messages are not discarded.

Summary of ZMQ::Socket::Pair characteristics

Compatible peer sockets

ZMQ::Socket::Pair

Direction

Bidirectional

Send/receive pattern

Unrestricted

Incoming routing strategy

N/A

Outgoing routing strategy

N/A

ZMQ::Socket#hwm option action

Block

"PAIR"
REXP_INPROC =
/inproc:\/\//

Constants inherited from ZMQ::Socket

BOUND, CONNECTED, PENDING, PROTO_REXP

Instance Method Summary collapse

Methods inherited from ZMQ::Socket

#affinity, #affinity=, #backlog, #backlog=, #close, #connect_all, #endpoint, #endpoints, #events, #fd, handle_fsm_errors, #hwm, #hwm=, #identity=, #linger, #linger=, #mcast_loop=, #mcast_loop?, #monitor, #poll_readable?, #poll_writable?, #rate, #rate=, #raw=, #rcvbuf, #rcvbuf=, #rcvhwm, #rcvhwm=, #rcvmore?, #rcvtimeo, #rcvtimeo=, #readable?, #real_bind, #real_connect, #reconnect_ivl, #reconnect_ivl=, #reconnect_ivl_max, #reconnect_ivl_max=, #recovery_ivl, #recovery_ivl=, #recovery_ivl_msec, #recovery_ivl_msec=, #recv, #recv_frame, #recv_frame_nonblock, #recv_message, #recv_nonblock, #send, #send_frame, #send_message, #sendm, #sndbuf, #sndbuf=, #sndhwm, #sndhwm=, #sndtimeo, #sndtimeo=, #state, #subscribe, #swap, #swap=, #to_s, #type_str, #unsubscribe, unsupported_api, #verbose=, #writable?

Instance Method Details

#bind(endpoint) ⇒ Object

Raises:


26
27
28
29
# File 'lib/zmq/socket/pair.rb', line 26

def bind(endpoint)
  raise(ZMQ::Error, "PAIR sockets can only listen using the inproc:// transport") unless endpoint =~ REXP_INPROC
  super
end

#connect(endpoint) ⇒ Object

Raises:


31
32
33
34
# File 'lib/zmq/socket/pair.rb', line 31

def connect(endpoint)
  raise(ZMQ::Error, "PAIR sockets can only connect using the inproc:// transport") unless endpoint =~ REXP_INPROC
  super
end

#typeObject


36
37
38
# File 'lib/zmq/socket/pair.rb', line 36

def type
  ZMQ::PAIR
end