zeromq.zmq documentation

bind

(bind socket endpoint)
The bind function binds the socket to an endpoint and then accepts
incoming connections on that endpoint.

The endpoint is a string consisting of a transport :// followed by an
address. The transport specifies the underlying protocol to use. The address
specifies the transport-specific address to bind to.

ØMQ provides the the following transports: tcp, ipc, inproc, pgm/epgm

bind-random-port

(bind-random-port socket endpoint)
Bind to the first free port. Endpoint should be of the form
<transport>://address the port will automatically be added.

close

Shall attempt to call the close option on either a ZContext or Socket

connect

(connect socket endpoint)
The connect function connects the socket to an endpoint and then accepts
incoming connections on that endpoint.

The endpoint is a string consisting of a transport :// followed by an
address. The transport specifies the underlying protocol to use. The address
specifies the transport-specific address to connect to.

ØMQ provides the the following transports: tcp, ipc, inproc, pgm/epgm.

context

(context)(context io-threads)
The context function initialises a new ØMQ context.

The io_threads argument specifies the size of the ØMQ thread pool to handle
I/O operations. If your application is using only the inproc transport for
messaging you may set this to zero, otherwise set it to at least one.

disconnect

(disconnect socket endpoint)
The disconnect function shall disconnect a socket specified by the socket
argument from the endpoint specified by the endpoint argument.

first-free-port

(first-free-port)
Returns first free ephemeral port

poller

The poller function provides a mechanism for applications to multiplex
input/output events in a level-triggered fashion over a set of sockets.

receive

(receive socket)(receive socket flags)(receive socket buffer offset len flags)
Receive method shall receive a message part from the socket and store it in the
buffer argument.

If there are no message parts available on the socket the receive method
shall block until the request can be satisfied.

receive-all

(receive-all socket)
Receive all data parts from the socket.

receive-more?

(receive-more? socket)
The receive-more? function shall return true if the message part last
received from the socket was a data part with more parts to follow. If there
are no data parts to follow, this function shall return false.

send

(send socket buf)(send socket buf flags)(send socket buf offset length flags)
Send method shall queue a message part created from the buffer argument on
the socket.

A successful invocation of send does not indicate that the message has been
transmitted to the network, only that it has been queued on the socket and
ØMQ has assumed responsibility for the message.

set-identity

(set-identity socket identity)
The identity option shall set the identity of the specified socket. Socket
identity is used only by request/reply pattern. Namely, it can be used in
tandem with ROUTER socket to route messages to the peer with specific
identity.

Identity should be at least one byte and at most 255 bytes long. Identities
starting with binary zero are reserved for use by ØMQ infrastructure.

If two peers use the same identity when connecting to a third peer, the
results shall be undefined.

set-linger

(set-linger socket linger-ms)
The linger option shall set the linger period for the specified socket. The
linger period determines how long pending messages which have yet to be sent
to a peer shall linger in memory after a socket is closed with close, and
further affects the termination of the socket's context with close. The
following outlines the different behaviours:

The default value of -1 specifies an infinite linger period. Pending messages
shall not be discarded after a call to close; attempting to terminate the
socket's context with close shall block until all pending messages have been
sent to a peer.

The value of 0 specifies no linger period. Pending messages shall be
discarded immediately when the socket is closed with close.

Positive values specify an upper bound for the linger period in
milliseconds. Pending messages shall not be discarded after a call to close;
attempting to terminate the socket's context with close shall block until
either all pending messages have been sent to a peer, or the linger period
expires, after which any pending messages shall be discarded.

set-receive-timeout

(set-receive-timeout socket timeout)
Sets the timeout for receive operation on the socket. If the value is 0,
recv will return immediately, with a EAGAIN error if there is no message to
receive. If the value is -1, it will block until a message is available. For
all other values, it will wait for a message for that amount of time before
returning with an EAGAIN error.

set-router-mandatory

(set-router-mandatory socket mandatory?)
Sets the ROUTER socket behavior when an unroutable message is encountered. A
value of 0 is the default and discards the message silently when it cannot be
routed. A value of 1 returns an EHOSTUNREACH error code if the message cannot
be routed.

socket

The socket function shall create a ØMQ socket within the specified
context. The type argument specifies the socket type, which determines the
semantics of communication over the socket.

The newly created socket is initially unbound, and not associated with any
endpoints. In order to establish a message flow a socket must first be
connected to at least one endpoint with connect, or at least one endpoint
must be created for accepting incoming connections with bind.

subscribe

The subscribe option shall establish a new message filter on a SUB
socket. Newly created SUB sockets shall filter out all incoming messages,
therefore you should call this option to establish an initial message filter.

An empty option_value of length zero shall subscribe to all incoming
messages. A non-empty option_value shall subscribe to all messages beginning
with the specified prefix. Multiple filters may be attached to a single SUB
socket, in which case a message shall be accepted if it matches at least one
filter.

unsubscribe

The unsubscribe option shall remove an existing message filter on a SUB
socket. The filter specified must match an existing filter previously
established with the subscribe option. If the socket has several instances of
the same filter attached the unsubscribe option shall remove only one
instance, leaving the rest in place and functional.