Learning and research on zeromq

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.