Pro.zmq — ZeroMQ API

Overview

The Pro.zmq module contains the ZeroMQ API.

Client-Server Using send/recv

The following code examples demonstrate how to create a client and a server using send/recv:

# client.py

from Pro.zmq import *
import ctypes

context = zmq_ctx_new()

socket = zmq_socket(context, ZMQ_REQ)
zmq_connect(socket, "tcp://localhost:5555")

for i in range(1000):
    zmq_send_bytes(socket, b"Hello, world!", 0)
print("info: sent")

zmq_close(socket)
zmq_ctx_destroy(context)
# server.py

from Pro.zmq import *

context = zmq_ctx_new()

socket = zmq_socket(context, ZMQ_REP)
rc = zmq_bind(socket, "tcp://127.0.0.1:5555")

if rc == 0:
    while True:
        b = zmq_recv_bytes(socket, 13, 0)
        print(b)
        break
else:
    print("error: couldn't bind to port")

zmq_close(socket)
zmq_ctx_destroy(context)

Client-Server Using Messages

The following code examples demonstrate how to create a client and a server using messages:

# client.py

from Pro.zmq import *
import ctypes

context = zmq_ctx_new()

socket = zmq_socket(context, ZMQ_REQ)
zmq_connect(socket, "tcp://localhost:5555")

msg = zmq_msg_t()
zmq_msg_init_bytes(msg, b"Hello, world!")
rc = zmq_msg_send(msg, socket, 0)
print(rc)
print("info: sent")

zmq_close(socket)
zmq_ctx_destroy(context)
# server.py

from Pro.zmq import *

context = zmq_ctx_new()

socket = zmq_socket(context, ZMQ_REP)
rc = zmq_bind(socket, "tcp://127.0.0.1:5555")

if rc == 0:
    msg = zmq_msg_t()
    zmq_msg_init(msg)
    while True:
        # wait until a message is received
        rc = zmq_msg_recv(msg, socket, 0)
        if rc != -1:
            print(zmq_msg_bytes(msg))
        zmq_msg_close (msg)
        break
else:
    print("error: couldn't bind to port")

zmq_close(socket)
zmq_ctx_destroy(context)

Module API

Pro.zmq module API.

Attributes:

EADDRINUSE

Address already in use.

EADDRNOTAVAIL

Cannot assign requested address.

EAFNOSUPPORT

Address family not supported.

ECONNABORTED

Connection aborted.

ECONNREFUSED

Connection refused.

ECONNRESET

Connection reset by peer.

EFSM

Operation cannot be accomplished in current state.

EHOSTUNREACH

No route to host.

EINPROGRESS

Operation in progress.

EMSGSIZE

Message too long.

EMTHREAD

No I/O thread available.

ENETDOWN

Network is down.

ENETRESET

Network dropped connection on reset.

ENETUNREACH

Network is unreachable.

ENOBUFS

No buffer space available.

ENOCOMPATPROTO

Protocol not compatible.

ENOTCONN

Transport endpoint is not connected.

ENOTSOCK

Socket operation on non-socket.

ENOTSUP

Operation not supported.

EPROTONOSUPPORT

Protocol not supported.

ETERM

Context was terminated.

ETIMEDOUT

Operation timed out.

ZMQ_AFFINITY

Set I/O thread affinity.

ZMQ_BACKLOG

Maximum length of the queue of outstanding connections.

ZMQ_BINDTODEVICE

Bind socket to a specific network interface.

ZMQ_BLOCKY

Enable or disable blocking mode on the socket.

ZMQ_CONFLATE

Enable or disable message conflation.

ZMQ_CONNECT_RID

Set the routing ID for connections.

ZMQ_CONNECT_ROUTING_ID

Alias for ZMQ_CONNECT_RID.

ZMQ_CONNECT_TIMEOUT

Set the connection timeout.

ZMQ_CURVE

Enable CurveZMQ security mechanism.

ZMQ_CURVE_PUBLICKEY

Set the CurveZMQ public key.

ZMQ_CURVE_SECRETKEY

Set the CurveZMQ secret key.

ZMQ_CURVE_SERVER

Enable CurveZMQ server mode.

ZMQ_CURVE_SERVERKEY

Set the CurveZMQ server key.

ZMQ_DEALER

Dealer socket type.

ZMQ_DEFINED_STDINT

Indicates that stdint.h is defined.

ZMQ_DELAY_ATTACH_ON_CONNECT

Delay attachment on connect.

ZMQ_DONTWAIT

Non-blocking mode flag.

ZMQ_EVENTS

Retrieve socket event flags.

ZMQ_EVENT_ACCEPTED

Event flag for accepted connections.

ZMQ_EVENT_ACCEPT_FAILED

Event flag for failed connection acceptance.

ZMQ_EVENT_ALL

Monitor all socket events.

ZMQ_EVENT_BIND_FAILED

Event flag for failed binding.

ZMQ_EVENT_CLOSED

Event flag for closed connections.

ZMQ_EVENT_CLOSE_FAILED

Event flag for failed closure.

ZMQ_EVENT_CONNECTED

Event flag for successful connections.

ZMQ_EVENT_CONNECT_DELAYED

Event flag for delayed connections.

ZMQ_EVENT_CONNECT_RETRIED

Event flag for retried connections.

ZMQ_EVENT_DISCONNECTED

Event flag for disconnections.

ZMQ_EVENT_HANDSHAKE_FAILED_AUTH

Event flag for authentication handshake failures.

ZMQ_EVENT_HANDSHAKE_FAILED_NO_DETAIL

Event flag for handshake failures without specific details.

ZMQ_EVENT_HANDSHAKE_FAILED_PROTOCOL

Event flag for protocol handshake failures.

ZMQ_EVENT_HANDSHAKE_SUCCEEDED

Event flag for successful handshakes.

ZMQ_EVENT_LISTENING

Event flag for listening state.

ZMQ_EVENT_MONITOR_STOPPED

Event flag indicating that socket monitoring has stopped.

ZMQ_FAIL_UNROUTABLE

Fail on unroutable messages.

ZMQ_FD

Retrieve the file descriptor.

ZMQ_FORWARDER

Forwarder device type.

ZMQ_GROUP_MAX_LENGTH

Maximum length for group names.

ZMQ_GSSAPI

Enable GSSAPI security mechanism.

ZMQ_GSSAPI_NT_HOSTBASED

GSSAPI host-based name type.

ZMQ_GSSAPI_NT_KRB5_PRINCIPAL

GSSAPI Kerberos 5 principal name type.

ZMQ_GSSAPI_NT_USER_NAME

GSSAPI user name type.

ZMQ_GSSAPI_PLAINTEXT

Enable plaintext GSSAPI authentication.

ZMQ_GSSAPI_PRINCIPAL

Set the GSSAPI principal name.

ZMQ_GSSAPI_PRINCIPAL_NAMETYPE

Set the GSSAPI principal name type.

ZMQ_GSSAPI_SERVER

Enable GSSAPI server mode.

ZMQ_GSSAPI_SERVICE_PRINCIPAL

Set the GSSAPI service principal name.

ZMQ_GSSAPI_SERVICE_PRINCIPAL_NAMETYPE

Set the GSSAPI service principal name type.

ZMQ_HANDSHAKE_IVL

Set the handshake interval.

ZMQ_HAS_CAPABILITIES

Check for capabilities support.

ZMQ_HAUSNUMERO

ZeroMQ internal error number.

ZMQ_HEARTBEAT_IVL

Set the heartbeat interval.

ZMQ_HEARTBEAT_TIMEOUT

Set the heartbeat timeout.

ZMQ_HEARTBEAT_TTL

Set the heartbeat Time-To-Live (TTL).

ZMQ_IDENTITY

Set the socket identity.

ZMQ_IMMEDIATE

Enable or disable immediate mode.

ZMQ_INVERT_MATCHING

Invert matching for subscriptions.

ZMQ_IO_THREADS

Set the number of I/O threads.

ZMQ_IO_THREADS_DFLT

Default number of I/O threads.

ZMQ_IPC_FILTER_GID

Set IPC filter GID.

ZMQ_IPC_FILTER_PID

Set IPC filter PID.

ZMQ_IPC_FILTER_UID

Set IPC filter UID.

ZMQ_IPV4ONLY

Restrict socket to IPv4 only.

ZMQ_IPV6

Enable IPv6 support.

ZMQ_LAST_ENDPOINT

Retrieve the last endpoint.

ZMQ_LINGER

Set the linger period.

ZMQ_MAXMSGSIZE

Set the maximum message size.

ZMQ_MAX_MSGSZ

Alias for ZMQ_MAXMSGSIZE.

ZMQ_MAX_SOCKETS

Set the maximum number of sockets.

ZMQ_MAX_SOCKETS_DFLT

Default maximum number of sockets.

ZMQ_MECHANISM

Security mechanism option.

ZMQ_MORE

Indicates more message parts to follow.

ZMQ_MSG_T_SIZE

Size of zmq_msg_t structure.

ZMQ_MULTICAST_HOPS

Set multicast hops.

ZMQ_MULTICAST_MAXTPDU

Set multicast maximum TPDU.

ZMQ_NOBLOCK

Alias for non-blocking mode.

ZMQ_NULL

Null value constant.

ZMQ_PAIR

Pair socket type.

ZMQ_PLAIN

PLAIN security mechanism.

ZMQ_PLAIN_PASSWORD

Set PLAIN password.

ZMQ_PLAIN_SERVER

Enable PLAIN server mode.

ZMQ_PLAIN_USERNAME

Set PLAIN username.

ZMQ_POLLERR

Poll error event.

ZMQ_POLLIN

Poll input event.

ZMQ_POLLITEMS_DFLT

Default number of poll items.

ZMQ_POLLOUT

Poll output event.

ZMQ_POLLPRI

Poll priority event.

ZMQ_PROBE_ROUTER

Enable probing on ROUTER sockets.

ZMQ_PROTOCOL_ERROR_WS_UNSPECIFIED

WebSocket protocol unspecified error.

ZMQ_PROTOCOL_ERROR_ZAP_BAD_REQUEST_ID

ZAP bad request ID error.

ZMQ_PROTOCOL_ERROR_ZAP_BAD_VERSION

ZAP bad version error.

ZMQ_PROTOCOL_ERROR_ZAP_INVALID_METADATA

ZAP invalid metadata error.

ZMQ_PROTOCOL_ERROR_ZAP_INVALID_STATUS_CODE

ZAP invalid status code error.

ZMQ_PROTOCOL_ERROR_ZAP_MALFORMED_REPLY

ZAP malformed reply error.

ZMQ_PROTOCOL_ERROR_ZAP_UNSPECIFIED

ZAP unspecified error.

ZMQ_PROTOCOL_ERROR_ZMTP_CRYPTOGRAPHIC

ZMTP cryptographic error.

ZMQ_PROTOCOL_ERROR_ZMTP_INVALID_METADATA

ZMTP invalid metadata error.

ZMQ_PROTOCOL_ERROR_ZMTP_INVALID_SEQUENCE

ZMTP invalid sequence error.

ZMQ_PROTOCOL_ERROR_ZMTP_KEY_EXCHANGE

ZMTP key exchange error.

ZMQ_PROTOCOL_ERROR_ZMTP_MALFORMED_COMMAND_ERROR

ZMTP malformed ERROR command.

ZMQ_PROTOCOL_ERROR_ZMTP_MALFORMED_COMMAND_HELLO

ZMTP malformed HELLO command.

ZMQ_PROTOCOL_ERROR_ZMTP_MALFORMED_COMMAND_INITIATE

ZMTP malformed INITIATE command.

ZMQ_PROTOCOL_ERROR_ZMTP_MALFORMED_COMMAND_MESSAGE

ZMTP malformed MESSAGE command.

ZMQ_PROTOCOL_ERROR_ZMTP_MALFORMED_COMMAND_READY

ZMTP malformed READY command.

ZMQ_PROTOCOL_ERROR_ZMTP_MALFORMED_COMMAND_UNSPECIFIED

ZMTP malformed unspecified command.

ZMQ_PROTOCOL_ERROR_ZMTP_MALFORMED_COMMAND_WELCOME

ZMTP malformed WELCOME command.

ZMQ_PROTOCOL_ERROR_ZMTP_MECHANISM_MISMATCH

ZMTP mechanism mismatch error.

ZMQ_PROTOCOL_ERROR_ZMTP_UNEXPECTED_COMMAND

ZMTP unexpected command error.

ZMQ_PROTOCOL_ERROR_ZMTP_UNSPECIFIED

ZMTP unspecified error.

ZMQ_PUB

Publish socket type.

ZMQ_PULL

Pull socket type.

ZMQ_PUSH

Push socket type.

ZMQ_QUEUE

Queue device type.

ZMQ_RATE

Set the send rate.

ZMQ_RCVBUF

Set receive buffer size.

ZMQ_RCVHWM

Set receive high water mark.

ZMQ_RCVMORE

Indicates more message parts to receive.

ZMQ_RCVTIMEO

Set receive timeout.

ZMQ_RECONNECT_IVL

Set reconnect interval.

ZMQ_RECONNECT_IVL_MAX

Set maximum reconnect interval.

ZMQ_RECOVERY_IVL

Set recovery interval.

ZMQ_REP

Reply socket type.

ZMQ_REQ

Request socket type.

ZMQ_REQ_CORRELATE

Enable correlated requests.

ZMQ_REQ_RELAXED

Enable relaxed request handling.

ZMQ_ROUTER

Router socket type.

ZMQ_ROUTER_BEHAVIOR

Set ROUTER behavior.

ZMQ_ROUTER_HANDOVER

Enable ROUTER handover.

ZMQ_ROUTER_MANDATORY

Enable mandatory ROUTER behavior.

ZMQ_ROUTER_RAW

Enable raw mode for ROUTER sockets.

ZMQ_ROUTING_ID

Set or retrieve the routing ID.

ZMQ_SHARED

Enable shared ownership.

ZMQ_SNDBUF

Set the send buffer size.

ZMQ_SNDHWM

Set the send high-water mark.

ZMQ_SNDMORE

Indicate more message parts to follow.

ZMQ_SNDTIMEO

Set the send timeout.

ZMQ_SOCKET_LIMIT

Set the socket limit.

ZMQ_SOCKS_PROXY

Set SOCKS proxy.

ZMQ_SRCFD

Retrieve the source file descriptor.

ZMQ_STREAM

Stream socket type.

ZMQ_STREAMER

Streamer device type.

ZMQ_STREAM_NOTIFY

Enable stream notifications.

ZMQ_SUB

Subscribe socket type.

ZMQ_SUBSCRIBE

Subscribe to a message prefix.

ZMQ_TCP_ACCEPT_FILTER

Set TCP accept filter.

ZMQ_TCP_KEEPALIVE

Enable TCP keepalive.

ZMQ_TCP_KEEPALIVE_CNT

Set TCP keepalive count.

ZMQ_TCP_KEEPALIVE_IDLE

Set TCP keepalive idle time.

ZMQ_TCP_KEEPALIVE_INTVL

Set TCP keepalive interval.

ZMQ_TCP_MAXRT

Set TCP maximum retransmissions.

ZMQ_THREAD_AFFINITY_CPU_ADD

Add CPU to thread affinity.

ZMQ_THREAD_AFFINITY_CPU_REMOVE

Remove CPU from thread affinity.

ZMQ_THREAD_NAME_PREFIX

Set thread name prefix.

ZMQ_THREAD_PRIORITY

Set thread priority.

ZMQ_THREAD_PRIORITY_DFLT

Default thread priority.

ZMQ_THREAD_SAFE

Enable thread-safe mode.

ZMQ_THREAD_SCHED_POLICY

Set thread scheduling policy.

ZMQ_THREAD_SCHED_POLICY_DFLT

Default thread scheduling policy.

ZMQ_TOS

Set Type of Service (TOS) for TCP packets.

ZMQ_TYPE

Retrieve the socket type.

ZMQ_UNSUBSCRIBE

Unsubscribe from a message prefix.

ZMQ_USE_FD

Enable use of file descriptors.

ZMQ_VERSION

Retrieve the ZeroMQ version as a single integer.

ZMQ_VERSION_MAJOR

Major version number of ZeroMQ.

ZMQ_VERSION_MINOR

Minor version number of ZeroMQ.

ZMQ_VERSION_PATCH

Patch version number of ZeroMQ.

ZMQ_VMCI_BUFFER_MAX_SIZE

Set the maximum VMCI buffer size.

ZMQ_VMCI_BUFFER_MIN_SIZE

Set the minimum VMCI buffer size.

ZMQ_VMCI_BUFFER_SIZE

Set the VMCI buffer size.

ZMQ_VMCI_CONNECT_TIMEOUT

Set the VMCI connection timeout.

ZMQ_XPUB

Extended publish socket type.

ZMQ_XPUB_MANUAL

Enable manual subscription management for XPUB sockets.

ZMQ_XPUB_NODROP

Enable no-drop mode for XPUB sockets.

ZMQ_XPUB_VERBOSE

Enable verbose mode for XPUB sockets.

ZMQ_XPUB_VERBOSER

Enable even more verbose mode for XPUB sockets.

ZMQ_XPUB_WELCOME_MSG

Set the XPUB welcome message.

ZMQ_XREP

Alias for ROUTER socket type.

ZMQ_XREQ

Alias for DEALER socket type.

ZMQ_XSUB

Alias for SUB socket type.

ZMQ_ZAP_DOMAIN

Set the ZAP (ZeroMQ Authentication Protocol) domain.

Functions:

zmq_bind(s_, addr_)

Bind a socket to an endpoint.

zmq_close(s_)

Close a socket.

zmq_connect(s_, addr_)

Connect a socket to an endpoint.

zmq_ctx_destroy(context_)

Destroy a ZeroMQ context.

zmq_ctx_get(context_, option_)

Get context options.

zmq_ctx_new()

Create a new ZeroMQ context.

zmq_ctx_set(context_, option_, optval_)

Set context options.

zmq_ctx_shutdown(context_)

Shutdown a ZeroMQ context.

zmq_ctx_term(context_)

Terminate a ZeroMQ context.

zmq_curve_keypair(z85_public_key_, …)

Generate a CurveZMQ keypair.

zmq_curve_public(z85_public_key_, …)

Compute the CurveZMQ public key from a secret key.

zmq_device(type_, frontend_, backend_)

Start a built-in device.

zmq_disconnect(s_, addr_)

Disconnect a socket from an endpoint.

zmq_errno()

Retrieve the ZeroMQ errno.

zmq_getsockopt(s_, option_, optval_, optvallen_)

Get socket options.

zmq_has(capability_)

Check for ZeroMQ capabilities.

zmq_init(io_threads_)

Initialize a ZeroMQ context.

zmq_msg_bytes(msg)

Retrieve message content as bytes.

zmq_msg_close(msg_)

Release message resources.

zmq_msg_copy(dest_, src_)

Copy a message.

zmq_msg_data(msg_)

Access message data.

zmq_msg_get(msg_, property_)

Get message properties.

zmq_msg_gets(msg_, property_)

Get message string property.

zmq_msg_init(msg_)

Initialize an empty message.

zmq_msg_init_bytes(msg, b)

Initialize a message with bytes.

zmq_msg_init_data(msg_, data_, size_, ffn_, …)

Initialize a message with provided data.

zmq_msg_init_size(msg_, size_)

Initialize a message of a given size.

zmq_msg_more(msg_)

Check for more message parts.

zmq_msg_move(dest_, src_)

Move a message.

zmq_msg_recv(msg_, s_, flags_)

Receive a message part.

zmq_msg_send(msg_, s_, flags_)

Send a message part.

zmq_msg_set(msg_, property_, optval_)

Set message properties.

zmq_msg_size(msg_)

Get the size of the message data.

zmq_poll(items_, nitems_, timeout_)

Poll sockets for events.

zmq_proxy(frontend_, backend_, capture_)

Start the built-in proxy.

zmq_proxy_steerable(frontend_, backend_, …)

Start a steerable proxy.

zmq_recv(s_, buf_, len_, flags_)

Receive a message.

zmq_recv_bytes(s, len, flags)

Receive a message as bytes.

zmq_recviov(s_, iov_, count_, flags_)

Receive a message using I/O vectors.

zmq_recvmsg(s_, msg_, flags_)

Receive a message part into a zmq_msg_t.

zmq_send(s_, buf_, len_, flags_)

Send a message.

zmq_send_bytes(s, b, flags)

Send a message from bytes.

zmq_send_const(s_, buf_, len_, flags_)

Send a constant message.

zmq_sendiov(s_, iov_, count_, flags_)

Send a message using I/O vectors.

zmq_sendmsg(s_, msg_, flags_)

Send a message part from a zmq_msg_t.

zmq_setsockopt(s_, option_, optval_, optvallen_)

Set socket options.

zmq_sleep(seconds_)

Sleep for a specified duration.

zmq_socket(context_, type_)

Create a ZeroMQ socket.

zmq_socket_monitor(s_, addr_, events_)

Monitor socket events.

zmq_stopwatch_intermediate(watch_)

Get intermediate stopwatch timing.

zmq_stopwatch_start()

Start a high-precision stopwatch.

zmq_stopwatch_stop(watch_)

Stop a stopwatch.

zmq_strerror(errnum_)

Retrieve error string.

zmq_term(context_)

Terminate a ZeroMQ context.

zmq_threadclose(thread_)

Close a ZeroMQ thread.

zmq_threadstart(func_, arg_)

Start a new thread.

zmq_timers_add(timers, interval, handler, arg)

Add a timer.

zmq_timers_cancel(timers, timer_id)

Cancel a timer.

zmq_unbind(s_, addr_)

Unbind a socket from an endpoint.

zmq_version(major_, minor_, patch_)

Get ZeroMQ version.

zmq_z85_decode(dest_, string_)

Decode a Z85-encoded string.

zmq_z85_encode(dest_, data_, size_)

Encode data to a Z85 string.

Classes:

zmq_msg_t()

ZeroMQ message object.

zmq_pollitem_t()

Poll item structure.

EADDRINUSE: Final[int]

Address already in use.

This error occurs when attempting to bind a socket to an address that is already in use.

EADDRNOTAVAIL: Final[int]

Cannot assign requested address.

This error occurs when the specified address is not available from the local machine.

EAFNOSUPPORT: Final[int]

Address family not supported.

This error occurs when the specified address family is not supported.

ECONNABORTED: Final[int]

Connection aborted.

This error occurs when a connection is aborted due to network or protocol errors.

ECONNREFUSED: Final[int]

Connection refused.

This error occurs when a connection attempt is rejected by the peer.

ECONNRESET: Final[int]

Connection reset by peer.

This error occurs when the connection is forcibly closed by the peer.

EFSM: Final[int]

Operation cannot be accomplished in current state.

This error occurs when a zmq socket is in the wrong state for the requested operation.

EHOSTUNREACH: Final[int]

No route to host.

This error occurs when the network cannot reach the specified host.

EINPROGRESS: Final[int]

Operation in progress.

This error occurs when an operation that takes a long time to complete is in progress.

EMSGSIZE: Final[int]

Message too long.

This error occurs when the message being sent exceeds the maximum allowed size.

EMTHREAD: Final[int]

No I/O thread available.

This error occurs when there is no I/O thread available to process the operation.

ENETDOWN: Final[int]

Network is down.

This error occurs when the network subsystem is unavailable.

ENETRESET: Final[int]

Network dropped connection on reset.

This error occurs when the network connection has been reset.

ENETUNREACH: Final[int]

Network is unreachable.

This error occurs when the network cannot reach the destination.

ENOBUFS: Final[int]

No buffer space available.

This error occurs when the system cannot allocate buffer space.

ENOCOMPATPROTO: Final[int]

Protocol not compatible.

This error occurs when the requested protocol is not compatible with the socket type.

ENOTCONN: Final[int]

Transport endpoint is not connected.

This error occurs when attempting to use a socket that is not connected.

ENOTSOCK: Final[int]

Socket operation on non-socket.

This error occurs when an operation is attempted on a non-socket object.

ENOTSUP: Final[int]

Operation not supported.

This error occurs when the requested operation is not supported by the socket.

EPROTONOSUPPORT: Final[int]

Protocol not supported.

This error occurs when the protocol requested is not supported.

ETERM: Final[int]

Context was terminated.

This error occurs when the ZeroMQ context has been terminated.

ETIMEDOUT: Final[int]

Operation timed out.

This error occurs when the operation cannot be completed within the specified time.

ZMQ_AFFINITY: Final[int]

Set I/O thread affinity.

Specifies the I/O thread affinity for newly created connections.

See also zmq_setsockopt() and zmq_getsockopt().

ZMQ_BACKLOG: Final[int]

Maximum length of the queue of outstanding connections.

Defines the maximum length for the queue of outstanding peer connections.

See also zmq_setsockopt() and zmq_getsockopt().

ZMQ_BINDTODEVICE: Final[int]

Bind socket to a specific network interface.

Allows binding a socket to a specific network device.

See also zmq_setsockopt() and zmq_getsockopt().

ZMQ_BLOCKY: Final[int]

Enable or disable blocking mode on the socket.

When set to a non-zero value, the socket operations will block until they can be completed. When set to zero, operations will be non-blocking.

See also zmq_setsockopt() and zmq_getsockopt().

ZMQ_CONFLATE: Final[int]

Enable or disable message conflation.

When enabled, the socket will keep only the last message, discarding any previous pending messages. This is useful for scenarios where only the most recent state is relevant.

See also zmq_setsockopt() and zmq_getsockopt().

ZMQ_CONNECT_RID: Final[int]

Set the routing ID for connections.

Specifies a routing identifier to be used when establishing connections. This can be used to control the routing of messages in complex topologies.

See also zmq_setsockopt() and zmq_getsockopt().

ZMQ_CONNECT_ROUTING_ID: Final[int]

Alias for ZMQ_CONNECT_RID.

Provides an alternative name for setting the routing ID for connections.

See also ZMQ_CONNECT_RID.

ZMQ_CONNECT_TIMEOUT: Final[int]

Set the connection timeout.

Specifies the timeout for connect operations in milliseconds. If the connection cannot be established within the specified time, the operation will fail.

See also zmq_setsockopt() and zmq_getsockopt().

ZMQ_CURVE: Final[int]

Enable CurveZMQ security mechanism.

When enabled, the socket will use CurveZMQ for encryption and authentication, ensuring secure communication.

See also ZMQ_CURVE_PUBLICKEY, ZMQ_CURVE_SECRETKEY, and zmq_setsockopt().

ZMQ_CURVE_PUBLICKEY: Final[int]

Set the CurveZMQ public key.

Specifies the public key used for CurveZMQ encryption and authentication.

See also ZMQ_CURVE, ZMQ_CURVE_SECRETKEY, and zmq_setsockopt().

ZMQ_CURVE_SECRETKEY: Final[int]

Set the CurveZMQ secret key.

Specifies the secret key used for CurveZMQ encryption and authentication.

See also ZMQ_CURVE, ZMQ_CURVE_PUBLICKEY, and zmq_setsockopt().

ZMQ_CURVE_SERVER: Final[int]

Enable CurveZMQ server mode.

When set, the socket operates in server mode for CurveZMQ, requiring clients to authenticate.

See also ZMQ_CURVE_SERVERKEY and zmq_setsockopt().

ZMQ_CURVE_SERVERKEY: Final[int]

Set the CurveZMQ server key.

Specifies the server’s secret key used for CurveZMQ authentication in server mode.

See also ZMQ_CURVE_SERVER and zmq_setsockopt().

ZMQ_DEALER: Final[int]

Dealer socket type.

A DEALER socket is an advanced socket type that can be used to implement load-balancing and asynchronous request/reply patterns.

See also zmq_socket(), ZMQ_ROUTER, and ZMQ_REQ.

ZMQ_DEFINED_STDINT: Final[int]

Indicates that stdint.h is defined.

Used internally to check for the availability of standard integer types.

ZMQ_DELAY_ATTACH_ON_CONNECT: Final[int]

Delay attachment on connect.

When enabled, the socket will delay attaching to connections until data is sent or received, which can help reduce connection churn.

See also zmq_setsockopt() and zmq_getsockopt().

ZMQ_DONTWAIT: Final[int]

Non-blocking mode flag.

When used with send or receive operations, the socket will return immediately instead of blocking if the operation cannot be completed.

See also ZMQ_BLOCKY.

ZMQ_EVENTS: Final[int]

Retrieve socket event flags.

Used to obtain the current event flags for a socket, indicating the types of events that have occurred.

See also zmq_getsockopt() and zmq_poll().

ZMQ_EVENT_ACCEPTED: Final[int]

Event flag for accepted connections.

Indicates that a new connection has been accepted on the socket.

See also ZMQ_EVENT_BIND_FAILED and ZMQ_EVENT_CONNECTED.

ZMQ_EVENT_ACCEPT_FAILED: Final[int]

Event flag for failed connection acceptance.

Indicates that the socket failed to accept a new connection.

See also ZMQ_EVENT_ACCEPTED.

ZMQ_EVENT_ALL: Final[int]

Monitor all socket events.

Used to subscribe to all possible events for socket monitoring.

See also ZMQ_EVENT_ACCEPTED, ZMQ_EVENT_CONNECTED, and other specific event flags.

ZMQ_EVENT_BIND_FAILED: Final[int]

Event flag for failed binding.

Indicates that the socket failed to bind to the specified endpoint.

See also ZMQ_EVENT_BIND_FAILED and ZMQ_EVENT_ACCEPTED.

ZMQ_EVENT_CLOSED: Final[int]

Event flag for closed connections.

Indicates that a connection has been closed.

See also ZMQ_EVENT_DISCONNECTED and ZMQ_EVENT_CLOSE_FAILED.

ZMQ_EVENT_CLOSE_FAILED: Final[int]

Event flag for failed closure.

Indicates that the socket failed to close a connection properly.

See also ZMQ_EVENT_CLOSED.

ZMQ_EVENT_CONNECTED: Final[int]

Event flag for successful connections.

Indicates that the socket has successfully connected to an endpoint.

See also ZMQ_EVENT_CONNECT_DELAYED and ZMQ_EVENT_CONNECT_RETRIED.

ZMQ_EVENT_CONNECT_DELAYED: Final[int]

Event flag for delayed connections.

Indicates that the socket’s connection attempt has been delayed.

See also ZMQ_EVENT_CONNECTED.

ZMQ_EVENT_CONNECT_RETRIED: Final[int]

Event flag for retried connections.

Indicates that the socket is retrying a connection after a previous attempt failed.

See also ZMQ_EVENT_CONNECTED.

ZMQ_EVENT_DISCONNECTED: Final[int]

Event flag for disconnections.

Indicates that the socket has been disconnected from an endpoint.

See also ZMQ_EVENT_CLOSED.

ZMQ_EVENT_HANDSHAKE_FAILED_AUTH: Final[int]

Event flag for authentication handshake failures.

Indicates that the authentication part of the handshake process has failed.

See also ZMQ_EVENT_HANDSHAKE_FAILED_PROTOCOL and ZMQ_EVENT_HANDSHAKE_SUCCEEDED.

ZMQ_EVENT_HANDSHAKE_FAILED_NO_DETAIL: Final[int]

Event flag for handshake failures without specific details.

Indicates that the handshake process failed, but no specific reason is provided.

See also ZMQ_EVENT_HANDSHAKE_FAILED_AUTH.

ZMQ_EVENT_HANDSHAKE_FAILED_PROTOCOL: Final[int]

Event flag for protocol handshake failures.

Indicates that the protocol part of the handshake process has failed.

See also ZMQ_EVENT_HANDSHAKE_FAILED_AUTH and ZMQ_EVENT_HANDSHAKE_SUCCEEDED.

ZMQ_EVENT_HANDSHAKE_SUCCEEDED: Final[int]

Event flag for successful handshakes.

Indicates that the handshake process between sockets has succeeded.

See also ZMQ_EVENT_HANDSHAKE_FAILED_AUTH and ZMQ_EVENT_HANDSHAKE_FAILED_PROTOCOL.

ZMQ_EVENT_LISTENING: Final[int]

Event flag for listening state.

Indicates that the socket is now listening for incoming connections.

See also ZMQ_EVENT_ACCEPTED and ZMQ_EVENT_BIND_FAILED.

ZMQ_EVENT_MONITOR_STOPPED: Final[int]

Event flag indicating that socket monitoring has stopped.

Indicates that the monitoring of the socket events has been successfully stopped.

See also ZMQ_EVENT_MONITOR_STARTED.

ZMQ_FAIL_UNROUTABLE: Final[int]

Fail on unroutable messages.

When set, the socket will fail if a message cannot be routed to any peers.

See also zmq_setsockopt() and zmq_getsockopt().

ZMQ_FD: Final[int]

Retrieve the file descriptor.

Obtains the underlying file descriptor associated with the socket, which can be used for integration with event loops.

See also zmq_getsockopt().

ZMQ_FORWARDER: Final[int]

Forwarder device type.

Specifies that the device will act as a forwarder, simply passing messages from frontend to backend without modification.

See also zmq_device().

ZMQ_GROUP_MAX_LENGTH: Final[int]

Maximum length for group names.

Defines the maximum allowed length for group names used in certain socket options.

ZMQ_GSSAPI: Final[int]

Enable GSSAPI security mechanism.

When enabled, the socket will use GSSAPI for authentication and encryption.

See also zmq_setsockopt() and related GSSAPI options.

ZMQ_GSSAPI_NT_HOSTBASED: Final[int]

GSSAPI host-based name type.

Specifies that the GSSAPI principal name is host-based.

See also ZMQ_GSSAPI_NT_USER_NAME and ZMQ_GSSAPI_NT_KRB5_PRINCIPAL.

ZMQ_GSSAPI_NT_KRB5_PRINCIPAL: Final[int]

GSSAPI Kerberos 5 principal name type.

Specifies that the GSSAPI principal name is a Kerberos 5 principal.

See also ZMQ_GSSAPI_NT_USER_NAME and ZMQ_GSSAPI_NT_HOSTBASED.

ZMQ_GSSAPI_NT_USER_NAME: Final[int]

GSSAPI user name type.

Specifies that the GSSAPI principal name is a user name.

See also ZMQ_GSSAPI_NT_HOSTBASED and ZMQ_GSSAPI_NT_KRB5_PRINCIPAL.

ZMQ_GSSAPI_PLAINTEXT: Final[int]

Enable plaintext GSSAPI authentication.

When set, the socket will use plaintext mode for GSSAPI authentication.

See also ZMQ_GSSAPI.

ZMQ_GSSAPI_PRINCIPAL: Final[int]

Set the GSSAPI principal name.

Specifies the GSSAPI principal name used for authentication.

See also zmq_setsockopt() and ZMQ_GSSAPI.

ZMQ_GSSAPI_PRINCIPAL_NAMETYPE: Final[int]

Set the GSSAPI principal name type.

Specifies the type of the GSSAPI principal name, such as host-based or user name.

See also ZMQ_GSSAPI_NT_USER_NAME, ZMQ_GSSAPI_NT_HOSTBASED, and ZMQ_GSSAPI_NT_KRB5_PRINCIPAL.

ZMQ_GSSAPI_SERVER: Final[int]

Enable GSSAPI server mode.

When set, the socket operates in server mode for GSSAPI, requiring clients to authenticate.

See also ZMQ_GSSAPI_SERVICE_PRINCIPAL and zmq_setsockopt().

ZMQ_GSSAPI_SERVICE_PRINCIPAL: Final[int]

Set the GSSAPI service principal name.

Specifies the service principal name used for GSSAPI authentication in server mode.

See also ZMQ_GSSAPI_SERVER and zmq_setsockopt().

ZMQ_GSSAPI_SERVICE_PRINCIPAL_NAMETYPE: Final[int]

Set the GSSAPI service principal name type.

Specifies the type of the service principal name for GSSAPI authentication.

See also ZMQ_GSSAPI_PRINCIPAL_NAMETYPE.

ZMQ_HANDSHAKE_IVL: Final[int]

Set the handshake interval.

Specifies the interval for the handshake process in milliseconds.

See also zmq_setsockopt() and zmq_getsockopt().

ZMQ_HAS_CAPABILITIES: Final[int]

Check for capabilities support.

Indicates whether the ZeroMQ library has support for certain capabilities.

See also zmq_has().

ZMQ_HAUSNUMERO: Final[int]

ZeroMQ internal error number.

Represents an internal error code used by ZeroMQ.

ZMQ_HEARTBEAT_IVL: Final[int]

Set the heartbeat interval.

Specifies the interval at which heartbeat messages are sent to detect dead peers.

See also zmq_setsockopt() and zmq_getsockopt().

ZMQ_HEARTBEAT_TIMEOUT: Final[int]

Set the heartbeat timeout.

Specifies the timeout for heartbeat messages. If a heartbeat is not received within this time, the connection is considered dead.

See also zmq_setsockopt() and zmq_getsockopt().

ZMQ_HEARTBEAT_TTL: Final[int]

Set the heartbeat Time-To-Live (TTL).

Specifies how many heartbeat intervals a connection can miss before it is considered dead.

See also zmq_setsockopt() and zmq_getsockopt().

ZMQ_IDENTITY: Final[int]

Set the socket identity.

Assigns an identity to the socket, which can be used for routing messages in certain socket types like DEALER and ROUTER.

See also zmq_setsockopt() and zmq_getsockopt().

ZMQ_IMMEDIATE: Final[int]

Enable or disable immediate mode.

When set, the socket will not establish connections until a send or receive operation is performed.

See also zmq_setsockopt() and zmq_getsockopt().

ZMQ_INVERT_MATCHING: Final[int]

Invert matching for subscriptions.

When enabled, the socket will unsubscribe from all messages except those that match the subscription filter.

See also zmq_setsockopt() and zmq_getsockopt().

ZMQ_IO_THREADS: Final[int]

Set the number of I/O threads.

Specifies the number of I/O threads to be used by the ZeroMQ context for handling socket operations.

See also zmq_ctx_set() and zmq_ctx_get().

ZMQ_IO_THREADS_DFLT: Final[int]

Default number of I/O threads.

The default number of I/O threads used by a ZeroMQ context if not explicitly set.

ZMQ_IPC_FILTER_GID: Final[int]

Set IPC filter GID.

Specifies the Group ID (GID) used to filter incoming IPC connections.

See also zmq_setsockopt() and zmq_getsockopt().

ZMQ_IPC_FILTER_PID: Final[int]

Set IPC filter PID.

Specifies the Process ID (PID) used to filter incoming IPC connections.

See also zmq_setsockopt() and zmq_getsockopt().

ZMQ_IPC_FILTER_UID: Final[int]

Set IPC filter UID.

Specifies the User ID (UID) used to filter incoming IPC connections.

See also zmq_setsockopt() and zmq_getsockopt().

ZMQ_IPV4ONLY: Final[int]

Restrict socket to IPv4 only.

When set, the socket will only accept IPv4 connections, ignoring IPv6 addresses.

See also zmq_setsockopt() and zmq_getsockopt().

ZMQ_IPV6: Final[int]

Enable IPv6 support.

When set, the socket will support IPv6 addresses in addition to IPv4.

See also zmq_setsockopt() and zmq_getsockopt().

ZMQ_LAST_ENDPOINT: Final[int]

Retrieve the last endpoint.

Obtains the last endpoint to which the socket was connected or bound.

See also zmq_getsockopt().

ZMQ_LINGER: Final[int]

Set the linger period.

Specifies the time in milliseconds that the socket will attempt to send pending messages after a close operation before discarding them.

See also zmq_setsockopt() and zmq_getsockopt().

ZMQ_MAXMSGSIZE: Final[int]

Set the maximum message size.

Specifies the maximum size of messages that can be received on the socket. Messages larger than this size will be rejected.

See also zmq_setsockopt() and zmq_getsockopt().

ZMQ_MAX_MSGSZ: Final[int]

Alias for ZMQ_MAXMSGSIZE.

See also ZMQ_MAXMSGSIZE.

ZMQ_MAX_SOCKETS: Final[int]

Set the maximum number of sockets.

Specifies the maximum number of sockets that can be created within a ZeroMQ context.

See also zmq_ctx_set() and zmq_ctx_get().

ZMQ_MAX_SOCKETS_DFLT: Final[int]

Default maximum number of sockets.

Specifies the default maximum number of sockets that can be created within a ZeroMQ context.

See also zmq_ctx_set() and ZMQ_MAX_SOCKETS.

ZMQ_MECHANISM: Final[int]

Security mechanism option.

Specifies the security mechanism to be used by the socket, such as PLAIN or CURVE.

See also ZMQ_PLAIN, ZMQ_CURVE, and zmq_setsockopt().

ZMQ_MORE: Final[int]

Indicates more message parts to follow.

When set on a sent message, it signals that additional message parts will follow. Useful for multipart messaging.

See also zmq_send(), zmq_recv(), and ZMQ_RCVMORE.

ZMQ_MSG_T_SIZE: Final[int]

Size of zmq_msg_t structure.

Represents the size of the ZeroMQ message structure in bytes. Used internally for memory management.

ZMQ_MULTICAST_HOPS: Final[int]

Set multicast hops.

Specifies the number of network hops for multicast messages. Controls the scope of multicast traffic.

See also zmq_setsockopt() and zmq_getsockopt().

ZMQ_MULTICAST_MAXTPDU: Final[int]

Set multicast maximum TPDU.

Defines the maximum Transport Protocol Data Unit size for multicast messages, affecting fragmentation and transmission.

See also zmq_setsockopt() and zmq_getsockopt().

ZMQ_NOBLOCK: Final[int]

Alias for non-blocking mode.

When used with send or receive operations, the socket will return immediately instead of blocking if the operation cannot be completed.

See also ZMQ_DONTWAIT and ZMQ_BLOCKY.

ZMQ_NULL: Final[int]

Null value constant.

Represents a null value used in various ZeroMQ operations to indicate the absence of a valid pointer or value.

ZMQ_PAIR: Final[int]

Pair socket type.

A PAIR socket is used for connecting exactly two peers in a one-to-one communication pattern.

See also zmq_socket(), ZMQ_PUB, and ZMQ_SUB.

ZMQ_PLAIN: Final[int]

PLAIN security mechanism.

Specifies the use of the PLAIN security mechanism for authentication without encryption.

See also ZMQ_MECHANISM, ZMQ_PLAIN_USERNAME, ZMQ_PLAIN_PASSWORD, and zmq_setsockopt().

ZMQ_PLAIN_PASSWORD: Final[int]

Set PLAIN password.

Specifies the password used for PLAIN authentication.

See also ZMQ_PLAIN, ZMQ_PLAIN_USERNAME, and zmq_setsockopt().

ZMQ_PLAIN_SERVER: Final[int]

Enable PLAIN server mode.

When set, the socket operates in server mode for PLAIN authentication, requiring clients to provide valid credentials.

See also ZMQ_PLAIN_USERNAME, ZMQ_PLAIN_PASSWORD, and zmq_setsockopt().

ZMQ_PLAIN_USERNAME: Final[int]

Set PLAIN username.

Specifies the username used for PLAIN authentication.

See also ZMQ_PLAIN, ZMQ_PLAIN_PASSWORD, and zmq_setsockopt().

ZMQ_POLLERR: Final[int]

Poll error event.

Indicates that an error has occurred on the socket during polling.

See also ZMQ_POLLIN, ZMQ_POLLOUT, and ZMQ_POLLPRI.

ZMQ_POLLIN: Final[int]

Poll input event.

Indicates that there is data to read on the socket during polling.

See also ZMQ_POLLOUT, ZMQ_POLLPRI, and ZMQ_POLLERR.

ZMQ_POLLITEMS_DFLT: Final[int]

Default number of poll items.

Specifies the default size of the poll items array used in polling operations.

ZMQ_POLLOUT: Final[int]

Poll output event.

Indicates that the socket is ready for writing during polling.

See also ZMQ_POLLIN, ZMQ_POLLPRI, and ZMQ_POLLERR.

ZMQ_POLLPRI: Final[int]

Poll priority event.

Indicates that there is urgent data to read on the socket during polling.

See also ZMQ_POLLIN, ZMQ_POLLOUT, and ZMQ_POLLERR.

ZMQ_PROBE_ROUTER: Final[int]

Enable probing on ROUTER sockets.

Allows ROUTER sockets to probe for the presence of peers without establishing a connection.

See also zmq_setsockopt() and zmq_getsockopt().

ZMQ_PROTOCOL_ERROR_WS_UNSPECIFIED: Final[int]

WebSocket protocol unspecified error.

Represents an unspecified error in the WebSocket protocol handling.

ZMQ_PROTOCOL_ERROR_ZAP_BAD_REQUEST_ID: Final[int]

ZAP bad request ID error.

Indicates that the ZeroMQ Authentication Protocol (ZAP) received a request with an invalid request ID.

ZMQ_PROTOCOL_ERROR_ZAP_BAD_VERSION: Final[int]

ZAP bad version error.

Indicates that the ZAP received a request with an unsupported version.

ZMQ_PROTOCOL_ERROR_ZAP_INVALID_METADATA: Final[int]

ZAP invalid metadata error.

Indicates that the ZAP received invalid metadata in the authentication request.

ZMQ_PROTOCOL_ERROR_ZAP_INVALID_STATUS_CODE: Final[int]

ZAP invalid status code error.

Indicates that the ZAP received an invalid status code in the authentication response.

ZMQ_PROTOCOL_ERROR_ZAP_MALFORMED_REPLY: Final[int]

ZAP malformed reply error.

Indicates that the ZAP received a malformed reply during the authentication process.

ZMQ_PROTOCOL_ERROR_ZAP_UNSPECIFIED: Final[int]

ZAP unspecified error.

Represents an unspecified error in the ZAP authentication process.

ZMQ_PROTOCOL_ERROR_ZMTP_CRYPTOGRAPHIC: Final[int]

ZMTP cryptographic error.

Indicates a cryptographic error encountered during the ZeroMQ Message Transport Protocol (ZMTP) communication.

ZMQ_PROTOCOL_ERROR_ZMTP_INVALID_METADATA: Final[int]

ZMTP invalid metadata error.

Indicates that invalid metadata was received during the ZMTP communication.

ZMQ_PROTOCOL_ERROR_ZMTP_INVALID_SEQUENCE: Final[int]

ZMTP invalid sequence error.

Indicates that messages were received out of the expected sequence during ZMTP communication.

ZMQ_PROTOCOL_ERROR_ZMTP_KEY_EXCHANGE: Final[int]

ZMTP key exchange error.

Indicates a failure during the key exchange process in ZMTP communication.

ZMQ_PROTOCOL_ERROR_ZMTP_MALFORMED_COMMAND_ERROR: Final[int]

ZMTP malformed ERROR command.

Indicates that a malformed ERROR command was received during ZMTP communication.

ZMQ_PROTOCOL_ERROR_ZMTP_MALFORMED_COMMAND_HELLO: Final[int]

ZMTP malformed HELLO command.

Indicates that a malformed HELLO command was received during ZMTP communication.

ZMQ_PROTOCOL_ERROR_ZMTP_MALFORMED_COMMAND_INITIATE: Final[int]

ZMTP malformed INITIATE command.

Indicates that a malformed INITIATE command was received during ZMTP communication.

ZMQ_PROTOCOL_ERROR_ZMTP_MALFORMED_COMMAND_MESSAGE: Final[int]

ZMTP malformed MESSAGE command.

Indicates that a malformed MESSAGE command was received during ZMTP communication.

ZMQ_PROTOCOL_ERROR_ZMTP_MALFORMED_COMMAND_READY: Final[int]

ZMTP malformed READY command.

Indicates that a malformed READY command was received during ZMTP communication.

ZMQ_PROTOCOL_ERROR_ZMTP_MALFORMED_COMMAND_UNSPECIFIED: Final[int]

ZMTP malformed unspecified command.

Indicates that a malformed unspecified command was received during ZMTP communication.

ZMQ_PROTOCOL_ERROR_ZMTP_MALFORMED_COMMAND_WELCOME: Final[int]

ZMTP malformed WELCOME command.

Indicates that a malformed WELCOME command was received during ZMTP communication.

ZMQ_PROTOCOL_ERROR_ZMTP_MECHANISM_MISMATCH: Final[int]

ZMTP mechanism mismatch error.

Indicates that there was a mismatch in the security mechanisms negotiated during ZMTP communication.

ZMQ_PROTOCOL_ERROR_ZMTP_UNEXPECTED_COMMAND: Final[int]

ZMTP unexpected command error.

Indicates that an unexpected command was received during ZMTP communication.

ZMQ_PROTOCOL_ERROR_ZMTP_UNSPECIFIED: Final[int]

ZMTP unspecified error.

Represents an unspecified error in ZMTP communication.

ZMQ_PUB: Final[int]

Publish socket type.

A PUB socket is used to publish messages to multiple subscribers in a one-to-many communication pattern.

See also zmq_socket(), ZMQ_SUB, and ZMQ_XPUB.

ZMQ_PULL: Final[int]

Pull socket type.

A PULL socket is used to receive messages from a PUSH socket in a pipeline pattern.

See also zmq_socket(), ZMQ_PUSH, and ZMQ_XSUB.

ZMQ_PUSH: Final[int]

Push socket type.

A PUSH socket is used to send messages to a PULL socket in a pipeline pattern.

See also zmq_socket(), ZMQ_PULL, and ZMQ_XPUB.

ZMQ_QUEUE: Final[int]

Queue device type.

Specifies that the device will act as a queue, managing message queuing between frontend and backend sockets.

See also zmq_device().

ZMQ_RATE: Final[int]

Set the send rate.

Specifies the maximum send rate for messages in messages per second. Used to control the flow of outgoing messages.

See also zmq_setsockopt() and zmq_getsockopt().

ZMQ_RCVBUF: Final[int]

Set receive buffer size.

Specifies the size of the receive buffer for the socket in bytes. Determines how much incoming data can be buffered before it is processed.

See also zmq_setsockopt() and zmq_getsockopt().

ZMQ_RCVHWM: Final[int]

Set receive high water mark.

Specifies the high water mark for inbound messages on the socket. Limits the number of outstanding inbound messages to prevent resource exhaustion.

See also zmq_setsockopt() and zmq_getsockopt().

ZMQ_RCVMORE: Final[int]

Indicates more message parts to receive.

After receiving a message part, this option can be queried to determine if more message parts are to follow.

See also zmq_recv() and ZMQ_MORE.

ZMQ_RCVTIMEO: Final[int]

Set receive timeout.

Specifies the timeout for receive operations in milliseconds. If no message is received within this time, the operation will fail.

See also zmq_setsockopt() and zmq_getsockopt().

ZMQ_RECONNECT_IVL: Final[int]

Set reconnect interval.

Specifies the interval between reconnection attempts in milliseconds when a connection is lost.

See also zmq_setsockopt() and zmq_getsockopt().

ZMQ_RECONNECT_IVL_MAX: Final[int]

Set maximum reconnect interval.

Specifies the maximum interval between reconnection attempts in milliseconds.

See also zmq_setsockopt(), zmq_getsockopt(), and ZMQ_RECONNECT_IVL.

ZMQ_RECOVERY_IVL: Final[int]

Set recovery interval.

Specifies the interval after which the socket will attempt to recover from a failed connection.

See also zmq_setsockopt() and zmq_getsockopt().

ZMQ_REP: Final[int]

Reply socket type.

A REP socket is used to receive requests and send replies in a request-reply pattern.

See also zmq_socket(), ZMQ_REQ, and ZMQ_ROUTER.

ZMQ_REQ: Final[int]

Request socket type.

A REQ socket is used to send requests and receive replies in a request-reply pattern.

See also zmq_socket(), ZMQ_REP, and ZMQ_DEALER.

ZMQ_REQ_CORRELATE: Final[int]

Enable correlated requests.

When set, allows REQ sockets to correlate requests with replies, enabling more flexible communication patterns.

See also zmq_setsockopt() and ZMQ_REQ_RELAXED.

ZMQ_REQ_RELAXED: Final[int]

Enable relaxed request handling.

Allows REQ sockets to operate in a relaxed mode where strict request-reply sequencing is not enforced.

See also zmq_setsockopt() and ZMQ_REQ_CORRELATE.

ZMQ_ROUTER: Final[int]

Router socket type.

A ROUTER socket is an advanced socket type that can route messages to specific connected peers based on their identities.

See also zmq_socket(), ZMQ_DEALER, and ZMQ_REP.

ZMQ_ROUTER_BEHAVIOR: Final[int]

Set ROUTER behavior.

Specifies the behavior of the ROUTER socket, such as how it handles incoming connections and message routing.

See also zmq_setsockopt() and ZMQ_ROUTER_RAW.

ZMQ_ROUTER_HANDOVER: Final[int]

Enable ROUTER handover.

Allows ROUTER sockets to hand over the identity of a connected peer to another socket, facilitating seamless reconnections.

See also zmq_setsockopt() and ZMQ_ROUTING_ID.

ZMQ_ROUTER_MANDATORY: Final[int]

Enable mandatory ROUTER behavior.

When set, ROUTER sockets will enforce mandatory routing, rejecting messages that cannot be routed to any connected peers.

See also zmq_setsockopt() and ZMQ_ROUTER_RAW.

ZMQ_ROUTER_RAW: Final[int]

Enable raw mode for ROUTER sockets.

When set, the ROUTER socket operates in raw mode, allowing the application to handle message envelopes manually. This provides more control over message routing but requires handling the routing information explicitly.

See also ZMQ_ROUTER, zmq_setsockopt(), and zmq_getsockopt().

ZMQ_ROUTING_ID: Final[int]

Set or retrieve the routing ID.

Assigns or retrieves the routing identifier for a socket. This ID is used by ROUTER sockets to route messages to the correct connected peers.

See also ZMQ_IDENTITY, zmq_setsockopt(), and zmq_getsockopt().

ZMQ_SHARED: Final[int]

Enable shared ownership.

When set, multiple sockets can share ownership of the same underlying resources. This is useful for scenarios where multiple threads or processes need to access the same socket without interference.

See also zmq_setsockopt() and zmq_getsockopt().

ZMQ_SNDBUF: Final[int]

Set the send buffer size.

Specifies the size of the send buffer for a socket. This determines how much data can be queued for sending before blocking or failing.

See also zmq_setsockopt(), zmq_getsockopt(), and ZMQ_RCVBUF.

ZMQ_SNDHWM: Final[int]

Set the send high-water mark.

Defines the high-water mark for outbound messages on a socket. If the high-water mark is reached, additional send attempts will block or fail based on the socket’s configuration.

See also zmq_setsockopt(), zmq_getsockopt(), and ZMQ_RCVHWM.

ZMQ_SNDMORE: Final[int]

Indicate more message parts to follow.

When used with send operations, this flag indicates that more message parts will follow. This allows for the construction of multipart messages.

See also ZMQ_RCVMORE and zmq_msg_more().

ZMQ_SNDTIMEO: Final[int]

Set the send timeout.

Specifies the maximum time in milliseconds that a send operation will block waiting for buffer space. If the timeout is reached, the send operation will fail.

See also zmq_setsockopt(), zmq_getsockopt(), and ZMQ_RCVTIMEO.

ZMQ_SOCKET_LIMIT: Final[int]

Set the socket limit.

Specifies the maximum number of sockets that can be created within a ZeroMQ context.

See also zmq_ctx_set() and ZMQ_MAX_SOCKETS.

ZMQ_SOCKS_PROXY: Final[int]

Set SOCKS proxy.

Specifies the SOCKS proxy to be used for socket connections.

See also zmq_setsockopt() and ZMQ_MECHANISM.

ZMQ_SRCFD: Final[int]

Retrieve the source file descriptor.

Obtains the source file descriptor associated with a monitored socket, useful for integrating with external event loops.

See also zmq_getsockopt() and ZMQ_FD.

ZMQ_STREAM: Final[int]

Stream socket type.

A STREAM socket is used for bidirectional communication with remote peers, providing a continuous stream of messages.

See also zmq_socket(), ZMQ_PAIR, and ZMQ_STREAMER.

ZMQ_STREAMER: Final[int]

Streamer device type.

Specifies that the device will act as a streamer, forwarding messages between multiple pairs of frontend and backend sockets.

See also zmq_device().

ZMQ_STREAM_NOTIFY: Final[int]

Enable stream notifications.

When set, the STREAM socket will emit notifications about connection events, such as new connections or disconnections.

See also zmq_setsockopt() and ZMQ_EVENT_*.

ZMQ_SUB: Final[int]

Subscribe socket type.

A SUB socket is used to subscribe to messages from PUB sockets. It implements the subscriber side of the publish-subscribe pattern.

See also zmq_socket(), ZMQ_PUB, and ZMQ_XSUB.

ZMQ_SUBSCRIBE: Final[int]

Subscribe to a message prefix.

Sets the subscription filter for a SUB socket, specifying the prefix of messages to receive.

See also zmq_setsockopt(), ZMQ_UNSUBSCRIBE, and ZMQ_SUB.

ZMQ_TCP_ACCEPT_FILTER: Final[int]

Set TCP accept filter.

Specifies a filter function to be applied to incoming TCP connections, allowing selective acceptance based on custom criteria.

See also zmq_setsockopt() and ZMQ_BINDTODEVICE.

ZMQ_TCP_KEEPALIVE: Final[int]

Enable TCP keepalive.

When set, enables TCP keepalive probes on the socket to detect dead peers.

See also zmq_setsockopt() and ZMQ_TCP_KEEPALIVE_CNT.

ZMQ_TCP_KEEPALIVE_CNT: Final[int]

Set TCP keepalive count.

Specifies the number of TCP keepalive probes to send before considering the connection dead.

See also zmq_setsockopt() and ZMQ_TCP_KEEPALIVE.

ZMQ_TCP_KEEPALIVE_IDLE: Final[int]

Set TCP keepalive idle time.

Specifies the idle time in seconds before TCP keepalive probes are sent.

See also zmq_setsockopt() and ZMQ_TCP_KEEPALIVE.

ZMQ_TCP_KEEPALIVE_INTVL: Final[int]

Set TCP keepalive interval.

Specifies the interval in seconds between TCP keepalive probes.

See also zmq_setsockopt() and ZMQ_TCP_KEEPALIVE.

ZMQ_TCP_MAXRT: Final[int]

Set TCP maximum retransmissions.

Specifies the maximum number of TCP retransmissions before giving up on a connection.

See also zmq_setsockopt() and ZMQ_TCP_KEEPALIVE.

ZMQ_THREAD_AFFINITY_CPU_ADD: Final[int]

Add CPU to thread affinity.

Adds a CPU core to the thread affinity mask, binding the thread to the specified CPU.

See also zmq_setsockopt() and ZMQ_THREAD_AFFINITY_CPU_REMOVE.

ZMQ_THREAD_AFFINITY_CPU_REMOVE: Final[int]

Remove CPU from thread affinity.

Removes a CPU core from the thread affinity mask, unbinding the thread from the specified CPU.

See also zmq_setsockopt() and ZMQ_THREAD_AFFINITY_CPU_ADD.

ZMQ_THREAD_NAME_PREFIX: Final[int]

Set thread name prefix.

Specifies a prefix for naming threads created by ZeroMQ, useful for debugging and monitoring.

See also zmq_setsockopt() and ZMQ_THREAD_SAFE.

ZMQ_THREAD_PRIORITY: Final[int]

Set thread priority.

Specifies the priority level for threads created by ZeroMQ.

See also zmq_setsockopt() and ZMQ_THREAD_PRIORITY_DFLT.

ZMQ_THREAD_PRIORITY_DFLT: Final[int]

Default thread priority.

Represents the default priority level for ZeroMQ threads if not explicitly set.

ZMQ_THREAD_SAFE: Final[int]

Enable thread-safe mode.

When set, allows ZeroMQ sockets to be safely used across multiple threads.

See also zmq_setsockopt() and ZMQ_SHARED.

ZMQ_THREAD_SCHED_POLICY: Final[int]

Set thread scheduling policy.

Specifies the scheduling policy for threads created by ZeroMQ, such as FIFO or Round-Robin.

See also zmq_setsockopt() and ZMQ_THREAD_SCHED_POLICY_DFLT.

ZMQ_THREAD_SCHED_POLICY_DFLT: Final[int]

Default thread scheduling policy.

Represents the default scheduling policy for ZeroMQ threads if not explicitly set.

ZMQ_TOS: Final[int]

Set Type of Service (TOS) for TCP packets.

Specifies the TOS field for outgoing TCP packets on the socket, allowing for Quality of Service (QoS) adjustments.

See also zmq_setsockopt() and ZMQ_TCP_KEEPALIVE.

ZMQ_TYPE: Final[int]

Retrieve the socket type.

Obtains the type of the socket, such as PUB, SUB, REQ, REP, etc.

See also zmq_getsockopt() and ZMQ_PUB.

ZMQ_UNSUBSCRIBE: Final[int]

Unsubscribe from a message prefix.

Removes a subscription filter from a SUB socket, stopping the reception of messages with the specified prefix.

See also zmq_setsockopt(), ZMQ_SUBSCRIBE, and ZMQ_SUB.

ZMQ_USE_FD: Final[int]

Enable use of file descriptors.

When set, allows the retrieval and usage of the underlying file descriptors associated with ZeroMQ sockets.

See also zmq_setsockopt() and ZMQ_FD.

ZMQ_VERSION: Final[int]

Retrieve the ZeroMQ version as a single integer.

Encodes the major, minor, and patch version numbers into a single integer for easy comparison.

See also zmq_version(), ZMQ_VERSION_MAJOR, ZMQ_VERSION_MINOR, and ZMQ_VERSION_PATCH.

ZMQ_VERSION_MAJOR: Final[int]

Major version number of ZeroMQ.

Represents the major component of the ZeroMQ version, indicating significant changes or updates.

See also ZMQ_VERSION, ZMQ_VERSION_MINOR, and ZMQ_VERSION_PATCH.

ZMQ_VERSION_MINOR: Final[int]

Minor version number of ZeroMQ.

Represents the minor component of the ZeroMQ version, indicating smaller feature additions or improvements.

See also ZMQ_VERSION, ZMQ_VERSION_MAJOR, and ZMQ_VERSION_PATCH.

ZMQ_VERSION_PATCH: Final[int]

Patch version number of ZeroMQ.

Represents the patch component of the ZeroMQ version, indicating bug fixes and minor tweaks.

See also ZMQ_VERSION, ZMQ_VERSION_MAJOR, and ZMQ_VERSION_MINOR.

ZMQ_VMCI_BUFFER_MAX_SIZE: Final[int]

Set the maximum VMCI buffer size.

Specifies the maximum size of the Virtual Machine Communication Interface (VMCI) buffer.

See also zmq_setsockopt() and ZMQ_VMCI_BUFFER_MIN_SIZE.

ZMQ_VMCI_BUFFER_MIN_SIZE: Final[int]

Set the minimum VMCI buffer size.

Specifies the minimum size of the Virtual Machine Communication Interface (VMCI) buffer.

See also zmq_setsockopt() and ZMQ_VMCI_BUFFER_MAX_SIZE.

ZMQ_VMCI_BUFFER_SIZE: Final[int]

Set the VMCI buffer size.

Specifies the size of the Virtual Machine Communication Interface (VMCI) buffer.

See also zmq_setsockopt() and ZMQ_VMCI_BUFFER_MIN_SIZE.

ZMQ_VMCI_CONNECT_TIMEOUT: Final[int]

Set the VMCI connection timeout.

Specifies the timeout for establishing connections over the Virtual Machine Communication Interface (VMCI).

See also zmq_setsockopt() and ZMQ_VMCI_BUFFER_SIZE.

ZMQ_XPUB: Final[int]

Extended publish socket type.

An XPUB socket extends the PUB socket by allowing subscription messages to be received from SUB sockets.

See also zmq_socket(), ZMQ_SUB, and ZMQ_XPUB_VERBOSE.

ZMQ_XPUB_MANUAL: Final[int]

Enable manual subscription management for XPUB sockets.

When set, the XPUB socket will not automatically subscribe to all incoming subscriptions, allowing for manual control.

See also zmq_setsockopt() and ZMQ_XPUB.

ZMQ_XPUB_NODROP: Final[int]

Enable no-drop mode for XPUB sockets.

When set, the XPUB socket will not drop subscription messages, ensuring all subscriptions are processed.

See also zmq_setsockopt() and ZMQ_XPUB.

ZMQ_XPUB_VERBOSE: Final[int]

Enable verbose mode for XPUB sockets.

When set, the XPUB socket will provide additional information about subscriptions and other events.

See also zmq_setsockopt() and ZMQ_XPUB.

ZMQ_XPUB_VERBOSER: Final[int]

Enable even more verbose mode for XPUB sockets.

When set, the XPUB socket will provide extended information about subscriptions and other events, beyond the standard verbose mode.

See also zmq_setsockopt() and ZMQ_XPUB_VERBOSE.

ZMQ_XPUB_WELCOME_MSG: Final[int]

Set the XPUB welcome message.

Configures the XPUB socket to send a welcome message to subscribers upon their subscription. This can be used to notify subscribers of initial state or metadata.

See also zmq_setsockopt(), zmq_getsockopt(), and ZMQ_XPUB_VERBOSE.

ZMQ_XREP: Final[int]

Alias for ROUTER socket type.

ZMQ_XREP is an older name for the ROUTER socket type. It is maintained for backward compatibility.

See also ZMQ_ROUTER and zmq_socket().

ZMQ_XREQ: Final[int]

Alias for DEALER socket type.

ZMQ_XREQ is an older name for the DEALER socket type. It is maintained for backward compatibility.

See also ZMQ_DEALER and zmq_socket().

ZMQ_XSUB: Final[int]

Alias for SUB socket type.

ZMQ_XSUB is an older name for the SUB socket type. It is maintained for backward compatibility.

See also ZMQ_SUB and zmq_socket().

ZMQ_ZAP_DOMAIN: Final[int]

Set the ZAP (ZeroMQ Authentication Protocol) domain.

Specifies the domain for ZAP authentication, allowing the application to categorize authentication requests based on different domains.

See also zmq_setsockopt(), zmq_getsockopt(), and the ZAP documentation.

zmq_bind(s_: native_pointer, addr_: str)int

Bind a socket to an endpoint.

Binds the socket referenced by s_ to the endpoint specified by addr_.

Parameters
  • s (native_pointer) – The socket to bind.

  • addr (str) – The endpoint to bind the socket to.

Returns

Returns 0 if successful; otherwise returns -1.

Return type

int

See also zmq_connect().

zmq_close(s_: native_pointer)int

Close a socket.

Closes the socket referenced by s_.

Parameters

s (native_pointer) – The socket to close.

Returns

Returns 0 if successful; otherwise returns -1.

Return type

int

zmq_connect(s_: native_pointer, addr_: str)int

Connect a socket to an endpoint.

Connects the socket referenced by s_ to the endpoint specified by addr_.

Parameters
  • s (native_pointer) – The socket to connect.

  • addr (str) – The endpoint to connect the socket to.

Returns

Returns 0 if successful; otherwise returns -1.

Return type

int

See also zmq_bind().

zmq_ctx_destroy(context_: native_pointer)int

Destroy a ZeroMQ context.

Terminates the context referenced by context_, closing any open sockets.

Parameters

context (native_pointer) – The context to destroy.

Returns

Returns 0 if successful; otherwise returns -1.

Return type

int

See also zmq_ctx_new().

zmq_ctx_get(context_: native_pointer, option_: int)int

Get context options.

Retrieves the value of the context option specified by option_.

Parameters
  • context (native_pointer) – The context to get the option from.

  • option (int) – The context option to retrieve.

Returns

The value of the option, or -1 on error.

Return type

int

See also zmq_ctx_set().

zmq_ctx_new()native_pointer

Create a new ZeroMQ context.

Initializes a new ZeroMQ context.

Returns

A pointer to the new context, or None on error.

Return type

native_pointer

See also zmq_ctx_destroy().

zmq_ctx_set(context_: native_pointer, option_: int, optval_: int)int

Set context options.

Sets the value of the context option specified by option_ to optval_.

Parameters
  • context (native_pointer) – The context to set the option on.

  • option (int) – The context option to set.

  • optval (int) – The value to set the option to.

Returns

Returns 0 if successful; otherwise returns -1.

Return type

int

See also zmq_ctx_get().

zmq_ctx_shutdown(context_: native_pointer)int

Shutdown a ZeroMQ context.

Initiates a shutdown of the context, stopping any blocking calls.

Parameters

context (native_pointer) – The context to shut down.

Returns

Returns 0 if successful; otherwise returns -1.

Return type

int

zmq_ctx_term(context_: native_pointer)int

Terminate a ZeroMQ context.

Immediately terminates the context, closing any open sockets.

Parameters

context (native_pointer) – The context to terminate.

Returns

Returns 0 if successful; otherwise returns -1.

Return type

int

zmq_curve_keypair(z85_public_key_: str, z85_secret_key_: str)int

Generate a CurveZMQ keypair.

Generates a new public and secret key pair for CurveZMQ security.

Parameters
  • z85_public_key (str) – Buffer to hold the generated public key (Z85-encoded).

  • z85_secret_key (str) – Buffer to hold the generated secret key (Z85-encoded).

Returns

Returns 0 if successful; otherwise returns -1.

Return type

int

zmq_curve_public(z85_public_key_: str, z85_secret_key_: str)int

Compute the CurveZMQ public key from a secret key.

Calculates the public key corresponding to a given secret key.

Parameters
  • z85_public_key (str) – Buffer to hold the computed public key (Z85-encoded).

  • z85_secret_key (str) – The secret key (Z85-encoded).

Returns

Returns 0 if successful; otherwise returns -1.

Return type

int

zmq_device(type_: int, frontend_: native_pointer, backend_: native_pointer)int

Start a built-in device.

Starts a ZeroMQ device to proxy messages between sockets.

Parameters
  • type (int) – The type of device to start.

  • frontend (native_pointer) – The frontend socket.

  • backend (native_pointer) – The backend socket.

Returns

Returns 0 if successful; otherwise returns -1.

Return type

int

Deprecated: Use zmq_proxy() instead.

zmq_disconnect(s_: native_pointer, addr_: str)int

Disconnect a socket from an endpoint.

Disconnects the socket referenced by s_ from the endpoint specified by addr_.

Parameters
  • s (native_pointer) – The socket to disconnect.

  • addr (str) – The endpoint to disconnect from.

Returns

Returns 0 if successful; otherwise returns -1.

Return type

int

See also zmq_connect().

zmq_errno()int

Retrieve the ZeroMQ errno.

Returns the value of the ZeroMQ-specific errno.

Returns

The current ZeroMQ errno.

Return type

int

zmq_getsockopt(s_: native_pointer, option_: int, optval_: native_pointer, optvallen_: size_t)int

Get socket options.

Retrieves the value of the socket option specified by option_.

Parameters
  • s (native_pointer) – The socket to get the option from.

  • option (int) – The socket option to retrieve.

  • optval (native_pointer) – Buffer to store the option value.

  • optvallen (size_t) – Size of the buffer.

Returns

Returns 0 if successful; otherwise returns -1.

Return type

int

See also zmq_setsockopt().

zmq_has(capability_: str)int

Check for ZeroMQ capabilities.

Determines if the ZeroMQ library supports a specific capability.

Parameters

capability (str) – The capability to check (e.g., “ipc”, “curve”).

Returns

1 if the capability is supported, 0 if not.

Return type

int

zmq_init(io_threads_: int)native_pointer

Initialize a ZeroMQ context.

Creates a new ZeroMQ context with the specified number of I/O threads.

Parameters

io_threads (int) – Number of I/O threads to create.

Returns

A pointer to the new context, or None on error.

Return type

native_pointer

Deprecated: Use zmq_ctx_new() instead.

zmq_msg_bytes(msg: Pro.zmq.zmq_msg_t)bytes

Retrieve message content as bytes.

Returns the content of the message msg as a bytes object.

Parameters

msg (zmq_msg_t) – The message to retrieve data from.

Returns

The message content.

Return type

bytes

zmq_msg_close(msg_: Pro.zmq.zmq_msg_t)int

Release message resources.

Closes the message and releases any associated resources.

Parameters

msg (zmq_msg_t) – The message to close.

Returns

Returns 0 if successful; otherwise returns -1.

Return type

int

See also zmq_msg_init().

zmq_msg_copy(dest_: Pro.zmq.zmq_msg_t, src_: Pro.zmq.zmq_msg_t)int

Copy a message.

Copies the content of src_ into dest_.

Parameters
Returns

Returns 0 if successful; otherwise returns -1.

Return type

int

zmq_msg_data(msg_: zmq_msg_t)native_pointer

Access message data.

Returns a pointer to the data buffer of the message msg_.

Parameters

msg (zmq_msg_t) – The message to access.

Returns

Pointer to the message data.

Return type

native_pointer

zmq_msg_get(msg_: Pro.zmq.zmq_msg_t, property_: int)int

Get message properties.

Retrieves the value of the message property specified by property_.

Parameters
  • msg (zmq_msg_t) – The message to get the property from.

  • property (int) – The property to retrieve.

Returns

The value of the property, or -1 on error.

Return type

int

See also zmq_msg_set().

zmq_msg_gets(msg_: Pro.zmq.zmq_msg_t, property_: str)str

Get message string property.

Retrieves the value of the message property specified by property_ as a string.

Parameters
  • msg (zmq_msg_t) – The message to get the property from.

  • property (str) – The property to retrieve.

Returns

The value of the property, or None on error.

Return type

str

zmq_msg_init(msg_: Pro.zmq.zmq_msg_t)int

Initialize an empty message.

Initializes a new empty message in msg_.

Parameters

msg (zmq_msg_t) – The message to initialize.

Returns

Returns 0 if successful; otherwise returns -1.

Return type

int

See also zmq_msg_close().

zmq_msg_init_bytes(msg: Pro.zmq.zmq_msg_t, b: bytes)int

Initialize a message with bytes.

Initializes a new message in msg_ with the content of b.

Parameters
  • msg (zmq_msg_t) – The message to initialize.

  • b (bytes) – The bytes to initialize the message with.

Returns

Returns 0 if successful; otherwise returns -1.

Return type

int

zmq_msg_init_data(msg_: zmq_msg_t, data_: native_pointer, size_: size_t, ffn_: zmq_free_fn, hint_: native_pointer)int

Initialize a message with provided data.

Initializes a message with data and a custom free function.

Parameters
  • msg (zmq_msg_t) – The message to initialize.

  • data (native_pointer) – Pointer to the data buffer.

  • size (size_t) – Size of the data buffer.

  • ffn (zmq_free_fn) – Function to free the data buffer.

  • hint (native_pointer) – Optional hint passed to the free function.

Returns

Returns 0 if successful; otherwise returns -1.

Return type

int

zmq_msg_init_size(msg_: zmq_msg_t, size_: size_t)int

Initialize a message of a given size.

Allocates a data buffer of size_ bytes and initializes the message.

Parameters
  • msg (zmq_msg_t) – The message to initialize.

  • size (size_t) – The size of the message data buffer.

Returns

Returns 0 if successful; otherwise returns -1.

Return type

int

zmq_msg_more(msg_: Pro.zmq.zmq_msg_t)int

Check for more message parts.

Determines if there are more message parts to receive.

Parameters

msg (zmq_msg_t) – The message to check.

Returns

1 if more parts are to follow, 0 if this is the last part.

Return type

int

zmq_msg_move(dest_: Pro.zmq.zmq_msg_t, src_: Pro.zmq.zmq_msg_t)int

Move a message.

Moves the content of src_ into dest_, leaving src_ empty.

Parameters
Returns

Returns 0 if successful; otherwise returns -1.

Return type

int

zmq_msg_recv(msg_: zmq_msg_t, s_: native_pointer, flags_: int)int

Receive a message part.

Receives a message part from socket s_ into msg_.

Parameters
  • msg (zmq_msg_t) – The message to store the received data.

  • s (native_pointer) – The socket to receive from.

  • flags (int) – Flags to modify the receive operation.

Returns

Number of bytes received, or -1 on error.

Return type

int

zmq_msg_send(msg_: zmq_msg_t, s_: native_pointer, flags_: int)int

Send a message part.

Sends a message part from msg_ over socket s_.

Parameters
  • msg (zmq_msg_t) – The message to send.

  • s (native_pointer) – The socket to send over.

  • flags (int) – Flags to modify the send operation.

Returns

Number of bytes sent, or -1 on error.

Return type

int

zmq_msg_set(msg_: Pro.zmq.zmq_msg_t, property_: int, optval_: int)int

Set message properties.

Sets the value of the message property specified by property_ to optval_.

Parameters
  • msg (zmq_msg_t) – The message to set the property on.

  • property (int) – The property to set.

  • optval (int) – The value to set the property to.

Returns

Returns 0 if successful; otherwise returns -1.

Return type

int

See also zmq_msg_get().

zmq_msg_size(msg_: zmq_msg_t)size_t

Get the size of the message data.

Returns the size of the data buffer in msg_.

Parameters

msg (zmq_msg_t) – The message to query.

Returns

The size of the message data in bytes.

Return type

size_t

class zmq_msg_t

ZeroMQ message object.

Represents a message to be sent or received via a ZeroMQ socket.

See also zmq_msg_init(), zmq_msg_send(), and zmq_msg_recv().

zmq_poll(items_: Pro.zmq.zmq_pollitem_t, nitems_: int, timeout_: int)int

Poll sockets for events.

Monitors sockets or file descriptors for events.

Parameters
  • items (zmq_pollitem_t) – Array of poll items to monitor.

  • nitems (int) – Number of items in the array.

  • timeout (int) – Maximum time in milliseconds to wait for events.

Returns

Number of items with events, or -1 on error.

Return type

int

class zmq_pollitem_t

Poll item structure.

Used to represent a socket or file descriptor for polling events.

Attributes:

  • socket: The ZeroMQ socket to poll.

  • fd: The file descriptor to poll.

  • events: The events to poll for.

  • revents: The events that occurred.

See also zmq_poll().

Attributes:

events

The events to poll for.

fd

The file descriptor to poll.

revents

The events that occurred.

socket

The ZeroMQ socket to poll.

events

The events to poll for.

This is a bitmask of the events to monitor (e.g., ZMQ_POLLIN, ZMQ_POLLOUT).

fd

The file descriptor to poll.

Specifies the file descriptor to monitor for events.

revents

The events that occurred.

After polling, this field indicates which events have occurred.

socket

The ZeroMQ socket to poll.

Specifies the ZeroMQ socket to monitor for events.

zmq_proxy(frontend_: native_pointer, backend_: native_pointer, capture_: native_pointer)int

Start the built-in proxy.

Starts the built-in proxy to forward messages between sockets.

Parameters
  • frontend (native_pointer) – The frontend socket.

  • backend (native_pointer) – The backend socket.

  • capture (native_pointer) – Optional socket for capturing messages.

Returns

Always returns -1.

Return type

int

See also zmq_proxy_steerable().

zmq_proxy_steerable(frontend_: native_pointer, backend_: native_pointer, capture_: native_pointer, control_: native_pointer)int

Start a steerable proxy.

Similar to zmq_proxy(), but allows the proxy to be controlled via the control_ socket.

Parameters
  • frontend (native_pointer) – The frontend socket.

  • backend (native_pointer) – The backend socket.

  • capture (native_pointer) – Optional socket for capturing messages.

  • control (native_pointer) – Socket to control the proxy.

Returns

Always returns -1.

Return type

int

zmq_recv(s_: native_pointer, buf_: native_pointer, len_: size_t, flags_: int)int

Receive a message.

Receives a message from socket s_ into buffer buf_.

Parameters
  • s (native_pointer) – The socket to receive from.

  • buf (native_pointer) – Buffer to store the received message.

  • len (size_t) – Maximum length of the buffer.

  • flags (int) – Flags to modify the receive operation.

Returns

Number of bytes received, or -1 on error.

Return type

int

zmq_recv_bytes(s: native_pointer, len: size_t, flags: int)bytes

Receive a message as bytes.

Receives a message from socket s_ and returns it as bytes.

Parameters
  • s (native_pointer) – The socket to receive from.

  • len (size_t) – Maximum number of bytes to receive.

  • flags (int) – Flags to modify the receive operation.

Returns

The received message as bytes.

Return type

bytes

zmq_recviov(s_: native_pointer, iov_: iovec, count_: size_t, flags_: int)int

Receive a message using I/O vectors.

Receives a message and stores it in multiple buffers specified by iov_.

Parameters
  • s (native_pointer) – The socket to receive from.

  • iov (iovec) – Array of I/O vectors.

  • count (size_t) – Number of I/O vectors.

  • flags (int) – Flags to modify the receive operation.

Returns

Total number of bytes received, or -1 on error.

Return type

int

zmq_recvmsg(s_: native_pointer, msg_: zmq_msg_t, flags_: int)int

Receive a message part into a zmq_msg_t.

Receives a message part from socket s_ into msg_.

Parameters
  • s (native_pointer) – The socket to receive from.

  • msg (zmq_msg_t) – The message to store the received data.

  • flags (int) – Flags to modify the receive operation.

Returns

Number of bytes received, or -1 on error.

Return type

int

zmq_send(s_: native_pointer, buf_: native_pointer, len_: size_t, flags_: int)int

Send a message.

Sends the message in buffer buf_ over socket s_.

Parameters
  • s (native_pointer) – The socket to send over.

  • buf (native_pointer) – The message buffer to send.

  • len (size_t) – Length of the message buffer.

  • flags (int) – Flags to modify the send operation.

Returns

Number of bytes sent, or -1 on error.

Return type

int

zmq_send_bytes(s: native_pointer, b: bytes, flags: int)int

Send a message from bytes.

Sends the bytes object b over socket s_.

Parameters
  • s (native_pointer) – The socket to send over.

  • b (bytes) – The bytes to send.

  • flags (int) – Flags to modify the send operation.

Returns

Number of bytes sent, or -1 on error.

Return type

int

zmq_send_const(s_: native_pointer, buf_: native_pointer, len_: size_t, flags_: int)int

Send a constant message.

Sends a constant message without copying the data.

Parameters
  • s (native_pointer) – The socket to send over.

  • buf (native_pointer) – The constant message buffer to send.

  • len (size_t) – Length of the message buffer.

  • flags (int) – Flags to modify the send operation.

Returns

Number of bytes sent, or -1 on error.

Return type

int

zmq_sendiov(s_: native_pointer, iov_: iovec, count_: size_t, flags_: int)int

Send a message using I/O vectors.

Sends a message composed of multiple buffers specified by iov_ over socket s_.

Parameters
  • s (native_pointer) – The socket to send over.

  • iov (iovec) – Array of I/O vectors.

  • count (size_t) – Number of I/O vectors.

  • flags (int) – Flags to modify the send operation.

Returns

Total number of bytes sent, or -1 on error.

Return type

int

zmq_sendmsg(s_: native_pointer, msg_: zmq_msg_t, flags_: int)int

Send a message part from a zmq_msg_t.

Sends the message part in msg_ over socket s_.

Parameters
  • s (native_pointer) – The socket to send over.

  • msg (zmq_msg_t) – The message to send.

  • flags (int) – Flags to modify the send operation.

Returns

Number of bytes sent, or -1 on error.

Return type

int

zmq_setsockopt(s_: native_pointer, option_: int, optval_: native_pointer, optvallen_: size_t)int

Set socket options.

Sets the value of the socket option specified by option_ to optval_.

Parameters
  • s (native_pointer) – The socket to set the option on.

  • option (int) – The socket option to set.

  • optval (native_pointer) – The value to set the option to.

  • optvallen (size_t) – Size of the option value.

Returns

Returns 0 if successful; otherwise returns -1.

Return type

int

See also zmq_getsockopt().

zmq_sleep(seconds_: int)None

Sleep for a specified duration.

Suspends execution for seconds_ seconds.

Parameters

seconds (int) – Number of seconds to sleep.

zmq_socket(context_: native_pointer, type_: int)native_pointer

Create a ZeroMQ socket.

Creates a new socket of the specified type_ within the given context_.

Parameters
  • context (native_pointer) – The ZeroMQ context.

  • type (int) – The type of socket to create.

Returns

A pointer to the new socket, or None on error.

Return type

native_pointer

See also zmq_close().

zmq_socket_monitor(s_: native_pointer, addr_: str, events_: int)int

Monitor socket events.

Enables monitoring of socket events by sending event messages to addr_.

Parameters
  • s (native_pointer) – The socket to monitor.

  • addr (str) – The endpoint to send event messages to.

  • events (int) – Bitmask of events to monitor.

Returns

Returns 0 if successful; otherwise returns -1.

Return type

int

zmq_stopwatch_intermediate(watch_: native_pointer)int

Get intermediate stopwatch timing.

Returns the elapsed time since the stopwatch was started.

Parameters

watch (native_pointer) – The stopwatch to query.

Returns

Elapsed time in microseconds.

Return type

int

zmq_stopwatch_start()native_pointer

Start a high-precision stopwatch.

Creates and starts a new stopwatch.

Returns

A pointer to the stopwatch.

Return type

native_pointer

See also zmq_stopwatch_stop().

zmq_stopwatch_stop(watch_: native_pointer)int

Stop a stopwatch.

Stops the stopwatch and returns the total elapsed time.

Parameters

watch (native_pointer) – The stopwatch to stop.

Returns

Total elapsed time in microseconds.

Return type

int

zmq_strerror(errnum_: int)str

Retrieve error string.

Returns the error message corresponding to errnum_.

Parameters

errnum (int) – The error number.

Returns

The error message.

Return type

str

zmq_term(context_: native_pointer)int

Terminate a ZeroMQ context.

Terminates the context, closing any open sockets.

Parameters

context (native_pointer) – The context to terminate.

Returns

Returns 0 if successful; otherwise returns -1.

Return type

int

Deprecated: Use zmq_ctx_term() instead.

zmq_threadclose(thread_: native_pointer)None

Close a ZeroMQ thread.

Terminates and cleans up the thread started by zmq_threadstart().

Parameters

thread (native_pointer) – The thread to close.

zmq_threadstart(func_: zmq_thread_fn, arg_: native_pointer)native_pointer

Start a new thread.

Starts a new thread executing func_ with argument arg_.

Parameters
  • func (zmq_thread_fn) – The function to execute in the thread.

  • arg (native_pointer) – Argument to pass to the function.

Returns

A pointer to the new thread.

Return type

native_pointer

zmq_timers_add(timers: native_pointer, interval: size_t, handler: zmq_timer_fn, arg: native_pointer)int

Add a timer.

Schedules a new timer to call handler every interval milliseconds.

Parameters
  • timers (native_pointer) – The timer object.

  • interval (size_t) – Interval in milliseconds.

  • handler (zmq_timer_fn) – Function to call when the timer expires.

  • arg (native_pointer) – Argument to pass to the handler.

Returns

The timer ID, or -1 on error.

Return type

int

zmq_timers_cancel(timers: native_pointer, timer_id: int)int

Cancel a timer.

Cancels the timer specified by timer_id.

Parameters
  • timers (native_pointer) – The timer object.

  • timer_id (int) – The ID of the timer to cancel.

Returns

Returns 0 if successful; otherwise returns -1.

Return type

int

zmq_unbind(s_: native_pointer, addr_: str)int

Unbind a socket from an endpoint.

Unbinds the socket referenced by s_ from the endpoint specified by addr_.

Parameters
  • s (native_pointer) – The socket to unbind.

  • addr (str) – The endpoint to unbind from.

Returns

Returns 0 if successful; otherwise returns -1.

Return type

int

See also zmq_bind().

zmq_version(major_: int, minor_: int, patch_: int)None

Get ZeroMQ version.

Retrieves the version numbers of the ZeroMQ library.

Parameters
  • major (int) – Variable to store the major version.

  • minor (int) – Variable to store the minor version.

  • patch (int) – Variable to store the patch version.

zmq_z85_decode(dest_: uint8_t, string_: str)uint8_t

Decode a Z85-encoded string.

Decodes a Z85-encoded string into binary data.

Parameters
  • dest (uint8_t) – Buffer to store the decoded data.

  • string (str) – The Z85-encoded string.

Returns

The decoded binary data.

Return type

uint8_t

zmq_z85_encode(dest_: str, data_: uint8_t, size_: size_t)str

Encode data to a Z85 string.

Encodes binary data into a Z85-encoded string.

Parameters
  • dest (str) – Buffer to store the encoded string.

  • data (uint8_t) – The binary data to encode.

  • size (size_t) – Size of the binary data.

Returns

The Z85-encoded string.

Return type

str