Class: ZMQ::Socket::Stream

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

Constant Summary collapse

TYPE_STR =

ZMQ::Socket::Stream

A socket of type ZMQ::Socket::Stream is used to send and receive TCP data from a non-ØMQ peer, when using the tcp:// transport. A ZMQ::Socket::Stream socket can act as client and/or server, sending and/or receiving TCP data asynchronously.

When receiving TCP data, a ZMQ::Socket::Stream socket shall prepend a message part containing the identity of the originating peer to the message before passing it to the application. Messages received are fair-queued from among all connected peers.

When sending TCP data, a ZMQ::Socket::Stream socket shall remove the first part of the message and use it to determine the identity of the peer the message shall be routed to, and unroutable messages shall cause an EHOSTUNREACH or EAGAIN error.

To open a connection to a server, use the zmq_connect call, and then fetch the socket identity using the ZMQ_IDENTITY zmq_getsockopt call.

To close a specific client connection, as a server, send the identity frame followed by a zero- length message (see EXAMPLE section).

The ZMQ_MSGMORE flag is ignored on data frames. You must send one identity frame followed by one data frame.

Also, please note that omitting the ZMQ_MSGMORE flag will prevent sending further data (from any client) on the same socket.

Summary of ZMQ_STREAM characteristics

Compatible peer sockets

none.

Direction

Bidirectional

Send/receive pattern

Unrestricted

Outgoing routing strategy

See text

Incoming routing strategy

Fair-queued

ZMQ::Socket#hwm option action

EAGAIN

"STREAM"

Constants inherited from ZMQ::Socket

BOUND, CONNECTED, DISCONNECTED, PENDING, PROTO_REXP

Instance Method Summary collapse

Methods inherited from ZMQ::Socket

#affinity, #affinity=, #backlog, #backlog=, #bind, #close, #connect, #connect_all, #delay_attach_on_connect=, #disconnect, #endpoint, #endpoints, #events, #fd, handle_fsm_errors, #identity=, #ipv4only=, #ipv4only?, #last_endpoint, #linger, #linger=, #maxmsgsize, #maxmsgsize=, #monitor, #multicast_hops, #multicast_hops=, #poll, #poll_readable?, #poll_writable?, #rate, #rate=, #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=, #recv, #recv_frame, #recv_frame_nonblock, #recv_message, #recv_nonblock, #router_mandatory=, #router_raw=, #send, #send_frame, #send_message, #sendm, #sndbuf, #sndbuf=, #sndhwm, #sndhwm=, #sndtimeo, #sndtimeo=, #state, #subscribe, #to_s, #type_str, #unbind, #unsubscribe, unsupported_api, #verbose=, #writable?, #xpub_verbose=

Instance Method Details

#typeObject



41
42
43
# File 'lib/zmq/socket/stream.rb', line 41

def type
  ZMQ::STREAM
end