我试图通过[[PUB
:将我的pyzmq
-客户端(使用udp://
context = zmq.Context()
socket = context.socket( zmq.PUB )
socket.connect( "udp://127.0.0.1:34567" )
但是代码总是抛出错误:zmq.error.ZMQError:协议与套接字类型不兼容
我已经尝试了所有套接字类型,例如:REQ, REP, PUB, SUB, PAIR, DEALER, ROUTER, PULL, PUSH
你知道出什么问题吗?
dish
和radio
,但它们是实验性的,可以阅读更多here相关报价:UDP传输只能与ZMQ_RADIO和ZMQ_DISH套接字一起使用类型。
UDP://
和{PGM|EPGM}://
传输类[C0的示例:
{ 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
套接字类型一起使用。UDP ZMQ_DISH
,.bind()
-s的示例类似:
.connect()
// Unicast - UDP port 5555 on all available interfaces rc = zmq_bind( dish, "udp://*:5555" ); assert ( rc == 0 and "ASSERT FAILED: udp://*:5555 ............. " );