In this chapter, you will learn about the basic communication patterns that are supported by ZeroMQ. Do not worry if all that sound a bit theoretical; you will implement all of these patterns yourself throughout the chapter.
The ZeroMQ library supports a variety of different communication patterns. For each of these, you will need different ZeroMQ socket types. The easiest communication pattern is the Request/reply pattern, in which a client opens an REQ socket and connects to a server listening on an REP socket. The client sends a request that is then replied to by the server.
It's important to know that REQ and REP sockets are always synchronous. Each REQ socket can be sending requests to a single REP socket at a time, and more importantly, each REP socket can also only be connected to a single REQ socket at a time. The ZeroMQ library even enforces this on the protocol level and triggers errors when an REQ socket tries to...