ZMQError: Cannot assign requested address

独自空忆成欢 提交于 2019-12-04 12:49:59

After you bring the interface up, you need to get its IP address and then bind on that. Alternatively you may be able to bind on "*", meaning all interfaces.

I got this error, too... and I realized I had the wrong idea of who was connecting to whom in the PUB/SUB model.

This was working: Host A as the ZMQ PUB, and could easily connect with Host A as the ZMQ SUB.

Then I tried to set up Host B as the SUB, and have Host A "send" to that... and I kept getting this error. After all don't you need to tell the PUB where to send the data?

No! Host A as the PUB should still bind to IP_ANY (0.0.0.0); it is Host B as the SUB who has to be configured with the address of Host A.

Once I got that straight in my code (and in my head), I was up and running.

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