Zeromq interface function: ZMQ_PGM–ØMQ uses PGM for reliable multiplexing

Source: Internet
Author: User
Tags creative commons attribution

ZeroMQ API Directory : http://www.cnblogs.com/fengbohello/p/4230135.html

—————————————————————————————————————

ZeroMQ Official Address : HTTP://API.ZEROMQ.ORG/4-0:ZMQ-PGM

ZMQ_PGM (7) ØMQ Manual-ømq/3.2.5

Name

ZMQ_PGM–ØMQ reliable multi-channel transmission using PGM

Synopsis

PGM (actual universal multicast) is a reliable multicast based on IP network protocol.

Description

There are two variants of ZMQ when implementing PGM, the standard protocol for the PGM datagram directly on the upper layer of the IP datagram, defined in RFC 3208 (PGM transfer), and "encapsulated PGM" or EPGM, at which time the PGM datagram is encapsulated inside the UDP datagram (EPGM transmission mode).

PGM and EPGM transmission methods can only be used by zmq_pub and zmq_sub two types of sockets.

By default, the rate of the sockets for PGM is limited. See the Zmq_rate and Zmq_recovery_ivl properties of the zmq_setsockopt (3) function for more details.

The implementation of PGM requires access to the original IP socket (socket). Additional functionality may require access to the operating system's operations. Applications that do not require interoperability with other PGM implementations can use EPGM, which does not require any privileges to be requested.

Addressing

An ZMQ endpoint is a string, including transport://followed by an address. The transport indicates the underlying protocol to use. Address indicates the way to connect the transport.

For PGM transmission, transport is PGM, for EPGM protocol, transport is EPGM. The meaning of address is defined below.

Connect a socket

When using the Zmq_connect () function to connect to the address of the other end with PGM or EPGM transmission, the endpoint (endpoint) should be a network port followed by a colon, followed by a multicast address, followed by a colon, followed by a port number.

A network port may be one of the following definitions:

The name of the network port defined by the operating system

The primary IPV4 address assigned to this network port, expressed in digital form

The network port name should not be standardized in any form, and should be assumed to be arbitrary and related to the peace platform. There is no short network port name on the Win32 platform, and only the IPV4 address can be used to specify a network port. The Network port section can be omitted, and the default network port is selected at this time.

A multicast address is represented as a numeric representation of IPV4.

Wired formats (wire format)

ZMQ will consider continuous PGM datagrams as a single continuous stream of data, ZMQ messages do not need to be aligned with PGM's datagrams, and a ZMQ message may span several PGM datagrams. The data flow consists of encapsulating the message frames defined in zmq_tcp (7) .

PGM Datagram Load

The next ABNF program represents the load of a single PGM datagram used by ZMQ:

Datagram               = (offset data) offset                 = 2OCTETdata                   = *octet

In order to differentiate the message boundary for the client that comes in later, each PGM datagram payload starts with a 16bit network byte, specifies the beginning of the first message frame in the datagram, or contains 0xFFFF if the datagram contains an intermediate portion of a large number of datagrams.

Note: Offset indicates the starting position of the first message, not the first frame of the message. Therefore, if several message frames are transmitted at the beginning of the packet, offset is ignored and points to the first initialized part of the package.

The following diagram illustrates the style of a single PGM datagram payload:

+------------------+----------------------+| Offset ( bits) |         Data         |+------------------+----------------------+

The following diagram further illustrates the layout of three ZMQ instances in a continuous PGM datagram:

First datagram Payload+--------------+-------------+---------------------+|   Frame Offset | Frame1| Frame2, part1||0x0000| (Message1) | (Message2, part1) |+--------------+-------------+---------------------+Second Datagram Payload+--------------+---------------------+|   Frame Offset | Frame2, part2||0xFFFF| (Message2, part2) |+--------------+---------------------+Third Datagram Payload+--------------+----------------------------+-------------+|   Frame Offset | Frame2, final8bytes | Frame3||0x0008| (Message2, final8bytes) | (Message3) |+--------------+----------------------------+-------------+

Example

  Connect a socket

//connecting to the multicast address 239.192.1.1, Port 5555,//using the first Ethernet network interface on Linux//And the encapsulated PGM protocolrc = Zmq_connect (socket,"epgm://eth0;239.192.1.1:5555"); Assert (RC==0);//connecting to the multicast address 239.192.1.1, Port 5555,//using the network interface with the address 192.168.1.1//And the standard PGM protocolrc = Zmq_connect (socket,"pgm://192.168.1.1;239.192.1.1:5555"); Assert (RC==0);

See Also

Zmq_connect (3) zmq_setsockopt (3) zmq_tcp (7) ZMQ_IPC (7) Zmq_inproc (7) ZMQ (7)

Authors

THISØMQ manual page was written by Pieter Hintjens <[email protected]>, Martin Sustrik <[email protected]> an D Martin Lucina <[email protected]>.

WEB site design and content is copyright (c) 2007-2012 Imatix Corporation. Contact us for professional support. Site content licensed under the Creative Commons attribution-share alike 3.0 License. ØMQ is copyright (c) Copyright (c) 2007-2012 Imatix Corporation and Contributors. ØMQ is free software licensed under the LGPL. ØMQ, ZeroMQ, and 0MQ are trademarks of Imatix Corporation. Terms of Use-privacy

Policy

Translation: The Storm

Mail: [Email protected]

Zeromq interface function: ZMQ_PGM–ØMQ uses PGM for reliable multiplexing

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.