ZeroMQ (also spelled ØMQ, 0MQ or ZMQ) is a high-performance asynchronous messaging library, aimed at use in distributed or concurrent applications. It provides a message queue, but unlike message-oriented middleware, a ZeroMQ system can run without a dedicated message broker.
ZeroMQ supports common messaging patterns (pub/sub, request/reply, client/server and others) over a variety of transports (TCP, in-process, inter-process, multicast, WebSocket and more), making inter-process messaging as simple as inter-thread messaging. This keeps your code clear, modular and extremely easy to scale.
ZeroMQ is developed by a large community of contributors. There are third-party bindings for many popular programming languages and native ports for C# and Java.
The Zero in ZeroMQ
The philosophy of ZeroMQ starts with the zero. The zero is for zero broker
(ZeroMQ is brokerless), zero latency, zero cost (it’s free), and zero
More generally, “zero” refers to the culture of minimalism that permeates the
project. We add power by removing complexity rather than by exposing new
The guide explains how to use ØMQ, covers basic, intermediate and advanced use with 60+ diagrams and 750 examples in 28 languages.
Libzmq (https://github.com/zeromq/libzmq) is the low-level library behind most of the different language bindings.
Libzmq expose C-API and implemented in C++.
You will rarely use libzmq directly, however if you want to contribute to the project or learn the internals of zeromq, that is the place to start.
using (var responder = new ResponseSocket())
string str = responder.ReceiveFrameString();
Thread.Sleep(1000); // Do some 'work'
Example hello_world_server is missing for clrzmq4. Would you like to contribute it? Then follow the steps below:
The server creates a socket of type response (you will read more about
request-response later), binds it to
port 5555 and then waits for messages. You can also see that we have zero
configuration, we are just sending strings.
The client creates a socket of type request, connects and starts sending
Both the send and receive methods are blocking (by default). For the receive
it is simple: if there are no messages the method will block. For sending it is
more complicated and depends on the socket type. For request sockets, if the
high watermark is reached or no peer is connected the method will block.