zeromq java linux,Linux上的ZeroMQ epgm错误:不支持协议

在Linux上尝试使用zmq进行多播时遇到问题,程序在绑定到epgm地址时崩溃。错误提示为'Protocol not supported'。经过研究发现,zmq不支持在相同主机上的环回功能,因此不能在同一主机上使用epgm进行发布和接收消息。解决方案是,在编译zmq时启用pgm支持,安装libpgm库。完成配置、编译和安装后,问题得到解决,现在可以成功绑定并使用epgm进行多播。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

I'm trying to multicast using zmq on Linux. My program dies on the line that tries to bind to the epgm address.

I ran the exact same code in VC++ while i was running the client and server both on the same host and it ran fine. However from what i've read by other programmers on this site, zmq does not support loopback functionality so I can't do publishes and receive the messages on the same host using epgm.

I moved the program to a linux box and I received an error. Here are the code and the error, do you know by any chance if this error has to do with me using an invalid IP for Linux?

zmq::context_t context( 1 );

zmq::socket_t publisher( context, ZMQ_PUB );

publisher.bind( "epgm://224.0.0.1:5555" );

Error line is the bind line.

Error is:

terminate called after throwing an instance of 'zmq::error_t'

what(): Protocol not supported

Thanks for the help

解决方案

I found the solution to this problem.

Apparently when you intend on using zmq for multicasts (pgm or epgm) you have to run the ./configure with pgm enabled then do a make after.

For this libpgm is required

In looking through my extracted tar zmq tar file under the folder /foreign/ there is a libpgm tar file.

So i just ran:

./configure --with-pgm=libpgm-5.2.122~dfsg

make

sudo make install

This solved the problem and i am able to bind using epgm now.

(obviously the version of libpgm will be the version in your zmq folder)

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值