我目前正在使用 Jgroups 版本 5 开发多播应用程序。顺便说一句,很棒的库。在我的实验室环境中,我有 2 个活动的以太网端口 BR1(桥接器)主接口和 eth0(用于监控) 有时,应用程序会选择 eth0,这不是主要接口。是否可以通过 xml 配置应用程序应该绑定到哪个端口。
我当前的 xml 文件如下。
<!--
Default stack using IP multicasting. It is similar to the "udp"
stack in stacks.xml, but doesn't use streaming state transfer and flushing
author: Bela Ban
-->
<config xmlns="urn:org:jgroups"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="urn:org:jgroups http://www.jgroups.org/schema/jgroups.xsd">
<UDP
mcast_port="${jgroups.udp.mcast_port:45588}"
mcast_addr="${jgroups.udp.mcast_addr:225.0.0.1}"
ip_ttl="${jgroups.udp.ip_ttl:32}"
thread_pool.min_threads="0"
thread_pool.max_threads="200"
thread_pool.keep_alive_time="30000"/>
<PING />
<MERGE3 max_interval="30000"
min_interval="10000"/>
<FD_SOCK/>
<FD_ALL3/>
<VERIFY_SUSPECT timeout="1500" />
<BARRIER />
<pbcast.NAKACK2 xmit_interval="500"/>
<UNICAST3 xmit_interval="500" />
<pbcast.STABLE desired_avg_gossip="50000"
max_bytes="512"/>
<pbcast.GMS print_local_addr="true" join_timeout="1000"/>
<UFC max_credits="9K"
min_threshold="0.4"/>
<MFC max_credits="9K"
min_threshold="0.4"/>
<FRAG2 frag_size="512" />
<pbcast.STATE_TRANSFER />
</config>