How to use Zeromq's inproc and ipc transports?

▼魔方 西西 提交于 2019-12-02 20:39:59

To the best of my knowledge, UDP is not supported by 0MQ. Also, IPC is only supported on OSes which have a POSIX-conforming implementation of named pipes; so, on Windows, you can really only use 'inproc', TCP, or PGM. However, above and beyond all this, one of 0MQ's major features is that your protocol is just part of the address. You can take any example, change the socket address, and everything should still work just fine (subject, of course, to the afore-mentioned restrictions). Also, the ZGuide has many examples (a good number of which are available in Python).

If (and only if) you use the ZMQ_PUB or ZMQ_SUB sockets - which you don't do in the examples you gave, where you use ROUTER, XREQ, etc - you can use UDP, or more precisely, UDP multicast via

"epgm://host:port"

EPGM stands for Encapsulated PGM, i.e. PGM encapsulated in UDP, which is more compatible with existing network infrastructure than raw PGM.

See also http://api.zeromq.org/2-1:zmq-pgm

I don't know of any UDP support for unicast scenarios though.

ZeroMQ has thread-safe UDP support as of March 2016:

  • You have to use the Radio/Dish pattern (very similar to Pub/Sub)
  • Supported in libzmq and czmq
  • See tests/test_udp.cpp, tests/test_radio_dish.cppin the libzmq source code
  • Full breakdown providided by Doron Somech on zeromq-dev@ list thread: Thread safe Pub/Sub and Multicast

I had the same problem when my pyzmq's and zmq's version is older version, I upgrade the version to 15.2.0, then resolved the problem, the ipc address prefix that I used is "inproc://"

os: win7-x64 python: 2.7.6

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!