Zeromq? (Also spell writing? MQ, 0mq, or zmq) is a lightweight open-source Message Queue software. It does not have an independent server, and messages are directly sent from one application to another. Zeromq? Learning and application is also very simple, it only has a single library file written in C ++? Libzmq. dll can be linked to any application. If you want ?. Net? Environment, we need to use one? C #? Compiled clrzmq. dll package library.
Zeromq? It can run on Windows, OS X, Linux, and other operating systems. C, C ++, and ,? Can C #, Java, Python, and other languages be compiled? Zeromq? Applications... This allows different applications on different platforms to communicate with each other.
Zeromq? Core
Zeromq? What is socket? Socket, but it does not directly use traditional sockets, but provides an abstract layer on the traditional Socket API, which frees users from complicated and repetitive programming tasks. Zeromq? Supports multiple types of sockets (the type is defined as an attribute of the socket itself ). The combination of the sender and receiver socket types creates a variety of communication modes, which will be involved later in this article.
Asynchronous Communication
Zeromq? The asynchronous communication mode is provided, which means that the application will not be blocked even when the socket connection is set or closed, reconnected, or the message is transmitted. Which of the following operations are performed in parallel with normal program tasks? Zeromq? It is managed in the background thread. Zeromq? Messages (whether sending or receiving) are automatically put into the queue. This process is intelligent, and messages are pushed to the queue as close as possible from the receiving end.
Transmission Protocol
Zeromq? Supports four types of transmission protocols. Each transport protocol is defined by an address string, which consists of two parts: Transport: // endpoint. The transport part specifies the underlying transport protocol used. The endpoint format varies with the protocol used, as shown below:
- TCP (TCP: // hostname: Port): Communication Between Hosts
- Inroc (inproc: // name): communication between threads of the same process (between threads)
- IPC (IPC: // tmp/filename): Communication Between processes on the same host
- PGM (PGM: // interface; Address: Port and epgm: // interface; Address: Port): Multicast Communication
Message format
Zeromq? By default, messages of the string and binary types can be sent or received, but the message format transmitted between sockets is not limited. We can freely choose message encoding, such as XML, JSON, messagepack... In this article, we only use strings for simplicity.
Learning and research on zeromq