Pro.zmq
— 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:
Address already in use.
Cannot assign requested address.
Address family not supported.
Connection aborted.
Connection refused.
Connection reset by peer.
Operation cannot be accomplished in current state.
No route to host.
Operation in progress.
Message too long.
No I/O thread available.
Network is down.
Network dropped connection on reset.
Network is unreachable.
No buffer space available.
Protocol not compatible.
Transport endpoint is not connected.
Socket operation on non-socket.
Operation not supported.
Protocol not supported.
Context was terminated.
Operation timed out.
Set I/O thread affinity.
Maximum length of the queue of outstanding connections.
Bind socket to a specific network interface.
Enable or disable blocking mode on the socket.
Enable or disable message conflation.
Set the routing ID for connections.
Alias for
ZMQ_CONNECT_RID
.Set the connection timeout.
Enable CurveZMQ security mechanism.
Set the CurveZMQ public key.
Set the CurveZMQ secret key.
Enable CurveZMQ server mode.
Set the CurveZMQ server key.
Dealer socket type.
Indicates that stdint.h is defined.
Delay attachment on connect.
Non-blocking mode flag.
Retrieve socket event flags.
Event flag for accepted connections.
Event flag for failed connection acceptance.
Monitor all socket events.
Event flag for failed binding.
Event flag for closed connections.
Event flag for failed closure.
Event flag for successful connections.
Event flag for delayed connections.
Event flag for retried connections.
Event flag for disconnections.
Event flag for authentication handshake failures.
Event flag for handshake failures without specific details.
Event flag for protocol handshake failures.
Event flag for successful handshakes.
Event flag for listening state.
Event flag indicating that socket monitoring has stopped.
Fail on unroutable messages.
Retrieve the file descriptor.
Forwarder device type.
Maximum length for group names.
Enable GSSAPI security mechanism.
GSSAPI host-based name type.
GSSAPI Kerberos 5 principal name type.
GSSAPI user name type.
Enable plaintext GSSAPI authentication.
Set the GSSAPI principal name.
Set the GSSAPI principal name type.
Enable GSSAPI server mode.
Set the GSSAPI service principal name.
Set the GSSAPI service principal name type.
Set the handshake interval.
Check for capabilities support.
ZeroMQ internal error number.
Set the heartbeat interval.
Set the heartbeat timeout.
Set the heartbeat Time-To-Live (TTL).
Set the socket identity.
Enable or disable immediate mode.
Invert matching for subscriptions.
Set the number of I/O threads.
Default number of I/O threads.
Set IPC filter GID.
Set IPC filter PID.
Set IPC filter UID.
Restrict socket to IPv4 only.
Enable IPv6 support.
Retrieve the last endpoint.
Set the linger period.
Set the maximum message size.
Alias for
ZMQ_MAXMSGSIZE
.Set the maximum number of sockets.
Default maximum number of sockets.
Security mechanism option.
Indicates more message parts to follow.
Size of zmq_msg_t structure.
Set multicast hops.
Set multicast maximum TPDU.
Alias for non-blocking mode.
Null value constant.
Pair socket type.
PLAIN security mechanism.
Set PLAIN password.
Enable PLAIN server mode.
Set PLAIN username.
Poll error event.
Poll input event.
Default number of poll items.
Poll output event.
Poll priority event.
Enable probing on ROUTER sockets.
WebSocket protocol unspecified error.
ZAP bad request ID error.
ZAP bad version error.
ZAP invalid metadata error.
ZAP invalid status code error.
ZAP malformed reply error.
ZAP unspecified error.
ZMTP cryptographic error.
ZMTP invalid metadata error.
ZMTP invalid sequence error.
ZMTP key exchange error.
ZMTP malformed ERROR command.
ZMTP malformed HELLO command.
ZMTP malformed INITIATE command.
ZMTP malformed MESSAGE command.
ZMTP malformed READY command.
ZMTP malformed unspecified command.
ZMTP malformed WELCOME command.
ZMTP mechanism mismatch error.
ZMTP unexpected command error.
ZMTP unspecified error.
Publish socket type.
Pull socket type.
Push socket type.
Queue device type.
Set the send rate.
Set receive buffer size.
Set receive high water mark.
Indicates more message parts to receive.
Set receive timeout.
Set reconnect interval.
Set maximum reconnect interval.
Set recovery interval.
Reply socket type.
Request socket type.
Enable correlated requests.
Enable relaxed request handling.
Router socket type.
Set ROUTER behavior.
Enable ROUTER handover.
Enable mandatory ROUTER behavior.
Enable raw mode for ROUTER sockets.
Set or retrieve the routing ID.
Enable shared ownership.
Set the send buffer size.
Set the send high-water mark.
Indicate more message parts to follow.
Set the send timeout.
Set the socket limit.
Set SOCKS proxy.
Retrieve the source file descriptor.
Stream socket type.
Streamer device type.
Enable stream notifications.
Subscribe socket type.
Subscribe to a message prefix.
Set TCP accept filter.
Enable TCP keepalive.
Set TCP keepalive count.
Set TCP keepalive idle time.
Set TCP keepalive interval.
Set TCP maximum retransmissions.
Add CPU to thread affinity.
Remove CPU from thread affinity.
Set thread name prefix.
Set thread priority.
Default thread priority.
Enable thread-safe mode.
Set thread scheduling policy.
Default thread scheduling policy.
Set Type of Service (TOS) for TCP packets.
Retrieve the socket type.
Unsubscribe from a message prefix.
Enable use of file descriptors.
Retrieve the ZeroMQ version as a single integer.
Major version number of ZeroMQ.
Minor version number of ZeroMQ.
Patch version number of ZeroMQ.
Set the maximum VMCI buffer size.
Set the minimum VMCI buffer size.
Set the VMCI buffer size.
Set the VMCI connection timeout.
Extended publish socket type.
Enable manual subscription management for XPUB sockets.
Enable no-drop mode for XPUB sockets.
Enable verbose mode for XPUB sockets.
Enable even more verbose mode for XPUB sockets.
Set the XPUB welcome message.
Alias for ROUTER socket type.
Alias for DEALER socket type.
Alias for SUB socket type.
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.
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.
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.
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:
ZeroMQ message object.
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()
andzmq_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()
andzmq_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()
andzmq_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()
andzmq_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()
andzmq_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()
andzmq_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()
andzmq_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
, andzmq_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
, andzmq_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
, andzmq_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
andzmq_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
andzmq_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
, andZMQ_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()
andzmq_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()
andzmq_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
andZMQ_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
andZMQ_EVENT_ACCEPTED
.
- ZMQ_EVENT_CLOSED: Final[int]¶
Event flag for closed connections.
Indicates that a connection has been closed.
See also
ZMQ_EVENT_DISCONNECTED
andZMQ_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
andZMQ_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
andZMQ_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
andZMQ_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
andZMQ_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
andZMQ_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()
andzmq_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
andZMQ_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
andZMQ_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
andZMQ_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()
andZMQ_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
, andZMQ_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
andzmq_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
andzmq_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()
andzmq_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()
andzmq_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()
andzmq_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()
andzmq_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()
andzmq_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()
andzmq_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()
andzmq_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()
andzmq_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()
andzmq_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()
andzmq_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()
andzmq_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()
andzmq_getsockopt()
.
- ZMQ_IPV6: Final[int]¶
Enable IPv6 support.
When set, the socket will support IPv6 addresses in addition to IPv4.
See also
zmq_setsockopt()
andzmq_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()
andzmq_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()
andzmq_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()
andzmq_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()
andZMQ_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
, andzmq_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()
, andZMQ_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()
andzmq_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()
andzmq_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
andZMQ_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
, andZMQ_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
, andzmq_setsockopt()
.
- ZMQ_PLAIN_PASSWORD: Final[int]¶
Set PLAIN password.
Specifies the password used for PLAIN authentication.
See also
ZMQ_PLAIN
,ZMQ_PLAIN_USERNAME
, andzmq_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
, andzmq_setsockopt()
.
- ZMQ_PLAIN_USERNAME: Final[int]¶
Set PLAIN username.
Specifies the username used for PLAIN authentication.
See also
ZMQ_PLAIN
,ZMQ_PLAIN_PASSWORD
, andzmq_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
, andZMQ_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
, andZMQ_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
, andZMQ_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
, andZMQ_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()
andzmq_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
, andZMQ_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
, andZMQ_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
, andZMQ_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()
andzmq_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()
andzmq_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()
andzmq_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()
andZMQ_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()
andzmq_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()
andzmq_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()
, andZMQ_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()
andzmq_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
, andZMQ_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
, andZMQ_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()
andZMQ_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()
andZMQ_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
, andZMQ_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()
andZMQ_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()
andZMQ_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()
andZMQ_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()
, andzmq_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()
, andzmq_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()
andzmq_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()
, andZMQ_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()
, andZMQ_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
andzmq_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()
, andZMQ_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()
andZMQ_MAX_SOCKETS
.
- ZMQ_SOCKS_PROXY: Final[int]¶
Set SOCKS proxy.
Specifies the SOCKS proxy to be used for socket connections.
See also
zmq_setsockopt()
andZMQ_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()
andZMQ_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
, andZMQ_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()
andZMQ_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
, andZMQ_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
, andZMQ_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()
andZMQ_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()
andZMQ_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()
andZMQ_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()
andZMQ_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()
andZMQ_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()
andZMQ_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()
andZMQ_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()
andZMQ_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()
andZMQ_THREAD_SAFE
.
- ZMQ_THREAD_PRIORITY: Final[int]¶
Set thread priority.
Specifies the priority level for threads created by ZeroMQ.
See also
zmq_setsockopt()
andZMQ_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()
andZMQ_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()
andZMQ_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()
andZMQ_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()
andZMQ_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
, andZMQ_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()
andZMQ_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
, andZMQ_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
, andZMQ_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
, andZMQ_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
, andZMQ_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()
andZMQ_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()
andZMQ_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()
andZMQ_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()
andZMQ_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
, andZMQ_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()
andZMQ_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()
andZMQ_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()
andZMQ_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()
andZMQ_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()
, andZMQ_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
andzmq_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
andzmq_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
andzmq_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_.
- 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.
- 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()
, andzmq_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:
The events to poll for.
The file descriptor to poll.
The events that occurred.
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