public static InetAddress getIpAddress() throws SocketException { return getIpAddress(new AddressSelectionCondition() { @Override public boolean isAcceptableAddress(InetAddress addr) { return addr instanceof Inet4Address || addr instanceof Inet6Address; } }); }
public static InetAddress getIp4Address() throws SocketException { return getIpAddress(new AddressSelectionCondition() { @Override public boolean isAcceptableAddress(InetAddress addr) { return addr instanceof Inet4Address; } }); }
public static InetAddress getIp6Address() throws SocketException { return getIpAddress(new AddressSelectionCondition() { @Override public boolean isAcceptableAddress(InetAddress addr) { return addr instanceof Inet6Address; } }); }
/** * @return Some IPv4/IPv6 address available on the current machine that is up, not virtual * and not a loopback address. Empty array if none can be found or error occurred. */ public static byte[] getIpAddressBytes() { try { return Addressing.getIpAddress().getAddress(); } catch (IOException ex) { LOG.warn("Failed to get IP address bytes", ex); } return new byte[0]; } }
ni = NetworkInterface.getByName(niName); } else { ni = NetworkInterface.getByInetAddress(Addressing.getIpAddress());
/** * @return Some IPv4/IPv6 address available on the current machine that is up, not virtual * and not a loopback address. Empty array if none can be found or error occurred. */ public static byte[] getIpAddressBytes() { try { return Addressing.getIpAddress().getAddress(); } catch (IOException ex) { LOG.warn("Failed to get IP address bytes", ex); } return new byte[0]; } }
ni = NetworkInterface.getByName(niName); } else { ni = NetworkInterface.getByInetAddress(Addressing.getIpAddress());
public static InetAddress getIp4Address() throws SocketException { return getIpAddress(new AddressSelectionCondition() { @Override public boolean isAcceptableAddress(InetAddress addr) { return addr instanceof Inet4Address; } }); }
public static InetAddress getIpAddress() throws SocketException { return getIpAddress(new AddressSelectionCondition() { @Override public boolean isAcceptableAddress(InetAddress addr) { return addr instanceof Inet4Address || addr instanceof Inet6Address; } }); }
public static InetAddress getIp6Address() throws SocketException { return getIpAddress(new AddressSelectionCondition() { @Override public boolean isAcceptableAddress(InetAddress addr) { return addr instanceof Inet6Address; } }); }
public static InetAddress getIp6Address() throws SocketException { return getIpAddress(new AddressSelectionCondition() { @Override public boolean isAcceptableAddress(InetAddress addr) { return addr instanceof Inet6Address; } }); }
public static InetAddress getIpAddress() throws SocketException { return getIpAddress(new AddressSelectionCondition() { @Override public boolean isAcceptableAddress(InetAddress addr) { return addr instanceof Inet4Address || addr instanceof Inet6Address; } }); }
public static InetAddress getIp4Address() throws SocketException { return getIpAddress(new AddressSelectionCondition() { @Override public boolean isAcceptableAddress(InetAddress addr) { return addr instanceof Inet4Address; } }); }
public static InetAddress getIp6Address() throws SocketException { return getIpAddress(new AddressSelectionCondition() { @Override public boolean isAcceptableAddress(InetAddress addr) { return addr instanceof Inet6Address; } }); }
public static InetAddress getIpAddress() throws SocketException { return getIpAddress(new AddressSelectionCondition() { @Override public boolean isAcceptableAddress(InetAddress addr) { return addr instanceof Inet4Address || addr instanceof Inet6Address; } }); }
public static InetAddress getIp4Address() throws SocketException { return getIpAddress(new AddressSelectionCondition() { @Override public boolean isAcceptableAddress(InetAddress addr) { return addr instanceof Inet4Address; } }); }
/** * @return Some IPv4/IPv6 address available on the current machine that is up, not virtual * and not a loopback address. Empty array if none can be found or error occurred. */ public static byte[] getIpAddressBytes() { try { return Addressing.getIpAddress().getAddress(); } catch (IOException ex) { LOG.warn("Failed to get IP address bytes", ex); } return new byte[0]; } }
/** * @return Some IPv4/IPv6 address available on the current machine that is up, not virtual * and not a loopback address. Empty array if none can be found or error occured. */ public static byte[] getIpAddressBytes() { try { return Addressing.getIpAddress().getAddress(); } catch (IOException ex) { LOG.warn("Failed to get IP address bytes", ex); } return new byte[0]; } }
@Override public void connect(Configuration conf) throws IOException { String mcAddress = conf.get(HConstants.STATUS_MULTICAST_ADDRESS, HConstants.DEFAULT_STATUS_MULTICAST_ADDRESS); String bindAddress = conf.get(HConstants.STATUS_MULTICAST_BIND_ADDRESS, HConstants.DEFAULT_STATUS_MULTICAST_BIND_ADDRESS); int port = conf.getInt(HConstants.STATUS_MULTICAST_PORT, HConstants.DEFAULT_STATUS_MULTICAST_PORT); InetAddress ina; try { ina = InetAddress.getByName(mcAddress); } catch (UnknownHostException e) { close(); throw new IOException("Can't connect to " + mcAddress, e); } try { Bootstrap b = new Bootstrap(); b.group(group) .channel(NioDatagramChannel.class) .option(ChannelOption.SO_REUSEADDR, true) .handler(new ClusterStatusHandler()); channel = (DatagramChannel)b.bind(bindAddress, port).sync().channel(); } catch (InterruptedException e) { close(); throw ExceptionUtil.asInterrupt(e); } NetworkInterface ni = NetworkInterface.getByInetAddress(Addressing.getIpAddress()); channel.joinGroup(ina, ni, null, channel.newPromise()); }
ni = NetworkInterface.getByName(niName); } else { ni = NetworkInterface.getByInetAddress(Addressing.getIpAddress());