org.jgroups.util.Util.getAllAvailableInterfaces()方法的使用及代码示例

x33g5p2x  于2022-02-01 转载在 其他  
字(5.3k)|赞(0)|评价(0)|浏览(193)

本文整理了Java中org.jgroups.util.Util.getAllAvailableInterfaces()方法的一些代码示例,展示了Util.getAllAvailableInterfaces()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Util.getAllAvailableInterfaces()方法的具体详情如下:
包路径:org.jgroups.util.Util
类名称:Util
方法名:getAllAvailableInterfaces

Util.getAllAvailableInterfaces介绍

暂无

代码示例

代码示例来源:origin: wildfly/wildfly

  1. protected Receiver() throws Exception {
  2. InetSocketAddress saddr=new InetSocketAddress(mcast_addr, mcast_port);
  3. if(can_bind_to_mcast_addr)
  4. mcast_sock=new MulticastSocket(saddr);
  5. else
  6. mcast_sock=new MulticastSocket(mcast_port);
  7. if(bind_addr != null)
  8. bindToInterfaces(Arrays.asList(NetworkInterface.getByInetAddress(bind_addr)), mcast_sock);
  9. else {
  10. List<NetworkInterface> intf_list=Util.getAllAvailableInterfaces();
  11. System.out.println("Joining " + saddr + " on interfaces: " + intf_list);
  12. bindToInterfaces(intf_list, mcast_sock);
  13. }
  14. System.out.println("Socket=" + mcast_sock.getLocalAddress() + ':' + mcast_sock.getLocalPort() + ", bind interface=" +
  15. mcast_sock.getInterface());
  16. }

代码示例来源:origin: wildfly/wildfly

  1. public void start() throws IOException {
  2. // https://jira.jboss.org/jira/browse/JGRP-777 - this doesn't work on MacOS, and we don't have
  3. // cross talking on Windows anyway, so we just do it for Linux. (How about Solaris ?)
  4. // if(can_bind_to_mcast_addr)
  5. // diag_sock=Util.createMulticastSocket(getSocketFactory(),
  6. // Global.TP_DIAG_MCAST_SOCK, diagnostics_addr, diagnostics_port, log);
  7. //else
  8. diag_sock=socket_factory.createMulticastSocket("jgroups.tp.diag.mcast_sock", diagnostics_port);
  9. diag_sock.setTimeToLive(ttl);
  10. List<NetworkInterface> interfaces=bind_interfaces != null? bind_interfaces : Util.getAllAvailableInterfaces();
  11. bindToInterfaces(interfaces, diag_sock);
  12. if(thread == null || !thread.isAlive()) {
  13. thread=thread_factory.newThread(this, THREAD_NAME);
  14. thread.setDaemon(true);
  15. thread.start();
  16. }
  17. }

代码示例来源:origin: wildfly/wildfly

  1. interfaces=receive_interfaces;
  2. else
  3. interfaces=Util.getAllAvailableInterfaces();
  4. bindToInterfaces(interfaces, mcast_sock, mcast_addr);
  5. interfaces=send_interfaces;
  6. else
  7. interfaces=Util.getAllAvailableInterfaces();
  8. mcast_send_sockets=new MulticastSocket[interfaces.size()];
  9. int index=0;

代码示例来源:origin: wildfly/wildfly

  1. interfaces=receive_interfaces;
  2. else
  3. interfaces=Util.getAllAvailableInterfaces();
  4. bindToInterfaces(interfaces, mcast_sock, mcast_addr.getIpAddress());

代码示例来源:origin: org.jgroups/com.springsource.org.jgroups

  1. void start() throws IOException {
  2. diag_sock=new MulticastSocket(diagnostics_port);
  3. java.util.List interfaces=Util.getAllAvailableInterfaces();
  4. bindToInterfaces(interfaces, diag_sock);
  5. if(thread == null || !thread.isAlive()) {
  6. thread=new Thread(Util.getGlobalThreadGroup(), this, THREAD_NAME);
  7. thread.setDaemon(true);
  8. thread.start();
  9. }
  10. }

代码示例来源:origin: org.jboss.eap/wildfly-client-all

  1. protected Receiver() throws Exception {
  2. InetSocketAddress saddr=new InetSocketAddress(mcast_addr, mcast_port);
  3. if(can_bind_to_mcast_addr)
  4. mcast_sock=new MulticastSocket(saddr);
  5. else
  6. mcast_sock=new MulticastSocket(mcast_port);
  7. if(bind_addr != null)
  8. bindToInterfaces(Arrays.asList(NetworkInterface.getByInetAddress(bind_addr)), mcast_sock);
  9. else {
  10. List<NetworkInterface> intf_list=Util.getAllAvailableInterfaces();
  11. System.out.println("Joining " + saddr + " on interfaces: " + intf_list);
  12. bindToInterfaces(intf_list, mcast_sock);
  13. }
  14. System.out.println("Socket=" + mcast_sock.getLocalAddress() + ':' + mcast_sock.getLocalPort() + ", bind interface=" +
  15. mcast_sock.getInterface());
  16. }

代码示例来源:origin: org.jboss.eap/wildfly-client-all

  1. public void start() throws IOException {
  2. // https://jira.jboss.org/jira/browse/JGRP-777 - this doesn't work on MacOS, and we don't have
  3. // cross talking on Windows anyway, so we just do it for Linux. (How about Solaris ?)
  4. // if(can_bind_to_mcast_addr)
  5. // diag_sock=Util.createMulticastSocket(getSocketFactory(),
  6. // Global.TP_DIAG_MCAST_SOCK, diagnostics_addr, diagnostics_port, log);
  7. //else
  8. diag_sock=socket_factory.createMulticastSocket("jgroups.tp.diag.mcast_sock", diagnostics_port);
  9. diag_sock.setTimeToLive(ttl);
  10. List<NetworkInterface> interfaces=bind_interfaces != null? bind_interfaces : Util.getAllAvailableInterfaces();
  11. bindToInterfaces(interfaces, diag_sock);
  12. if(thread == null || !thread.isAlive()) {
  13. thread=thread_factory.newThread(this, THREAD_NAME);
  14. thread.setDaemon(true);
  15. thread.start();
  16. }
  17. }

代码示例来源:origin: org.jgroups/com.springsource.org.jgroups

  1. interfaces=receive_interfaces;
  2. else
  3. interfaces=Util.getAllAvailableInterfaces();
  4. bindToInterfaces(interfaces, mcast_sock, mcast_addr);
  5. interfaces=send_interfaces;
  6. else
  7. interfaces=Util.getAllAvailableInterfaces();
  8. mcast_send_sockets=new MulticastSocket[interfaces.size()];
  9. int index=0;

代码示例来源:origin: org.jboss.eap/wildfly-client-all

  1. interfaces=receive_interfaces;
  2. else
  3. interfaces=Util.getAllAvailableInterfaces();
  4. bindToInterfaces(interfaces, mcast_sock, mcast_addr);
  5. interfaces=send_interfaces;
  6. else
  7. interfaces=Util.getAllAvailableInterfaces();
  8. mcast_send_sockets=new MulticastSocket[interfaces.size()];
  9. int index=0;

代码示例来源:origin: org.jgroups/com.springsource.org.jgroups

  1. interfaces=receive_interfaces;
  2. else
  3. interfaces=Util.getAllAvailableInterfaces();
  4. bindToInterfaces(interfaces, mcast_sock, mcast_addr.getIpAddress());
  5. interfaces=send_interfaces;
  6. else
  7. interfaces=Util.getAllAvailableInterfaces();
  8. mcast_send_sockets=new MulticastSocket[interfaces.size()];
  9. int index=0;

代码示例来源:origin: org.jboss.eap/wildfly-client-all

  1. interfaces=receive_interfaces;
  2. else
  3. interfaces=Util.getAllAvailableInterfaces();
  4. bindToInterfaces(interfaces, mcast_sock, mcast_addr.getIpAddress());

相关文章

Util类方法