ZeroMQ поддерживает оба:
и UDP://
и {PGM|EPGM}://
транспортные классы
Примеры { PGM | EPGM }
:
// Connecting to the multicast address 239.192.1.1, port 5555,
// using the first Ethernet network interface on Linux
// and the Encapsulated PGM protocol
rc = zmq_connect( socket, "epgm://eth0;239.192.1.1:5555" );
assert ( rc == 0 and "ASSERT FAILED: epgm://eth0;239.192.1.1:5555 ............. " );
// 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 protocol
rc = zmq_connect(socket, "pgm://192.168.1.1;239.192.1.1:5555" );
assert ( rc == 0 and "ASSERT FAILED: pgm://192.168.1.1;239.192.1.1:5555 ........" );
Транспорт pgm://
и epgm://
может использоваться только с ZMQ_PUB
и ZMQ_SUB
типы разъемов.
UDP://
транспортировка может использоваться только с разъемами ZMQ_RADIO
и ZMQ_DISH
типы.
Примеры UDP .bind()
, .connect()
-s аналогичны:
// Unicast - UDP port 5555 on all available interfaces
rc = zmq_bind( dish, "udp://*:5555" );
assert ( rc == 0 and "ASSERT FAILED: udp://*:5555 ............. " );
// Unicast - UDP port 5555 on the local loop-back interface
rc = zmq_bind( dish, "udp://127.0.0.1:5555" );
assert ( rc == 0 and "ASSERT FAILED: udp://127.0.0.1:5555 ............. " );
// Unicast - UDP port 5555 on interface eth1
rc = zmq_bind( dish, "udp://eth1:5555" );
assert ( rc == 0 and "ASSERT FAILED: udp://eth1:5555 ............. " );
// Multicast - UDP port 5555 on a Multicast address
rc = zmq_bind( dish, "udp://239.0.0.1:5555" );
assert ( rc == 0 and "ASSERT FAILED: udp://239.0.0.1:5555 ............. " );
// Same as above but joining only on interface eth0
rc = zmq_bind( dish, "udp://eth0;239.0.0.1:5555" );
assert ( rc == 0 and "ASSERT FAILED: udp://eth0;239.0.0.1:5555 ............. " );
// Same as above using IPv6 multicast
rc = zmq_bind( dish, "udp://eth0;[ff02::1]:5555" );
assert ( rc == 0 and "ASSERT FAILED: udp://eth0;[ff02::1]:5555 ............. " );
The Best Next Шаг:
Теперь рассмотрим область и состояние реализации pyzmq-19.0.0
native-API (будь то 4.3.2+ или более поздней).