/** * Check whether the given interface supports multicast and is up * * @param pNif check whether the given interface supports multicast * @return true if multicast is supported and the interface is up */ public static boolean isMulticastSupported(NetworkInterface pNif) { return pNif != null && checkMethod(pNif, isUp) && checkMethod(pNif, supportsMulticast); }
private static boolean useInetAddress(NetworkInterface networkInterface, InetAddress interfaceAddress) { return checkMethod(networkInterface, isUp) && checkMethod(networkInterface, supportsMulticast) && // TODO: IpV6 support !(interfaceAddress instanceof Inet6Address) && !interfaceAddress.isLoopbackAddress(); }
/** * Get all local addresses on which a multicast can be send * * @return list of all multi cast capable addresses */ public static List<InetAddress> getMulticastAddresses() throws SocketException { Enumeration<NetworkInterface> nifs = NetworkInterface.getNetworkInterfaces(); List<InetAddress> ret = new ArrayList<InetAddress>(); while (nifs.hasMoreElements()) { NetworkInterface nif = nifs.nextElement(); if (checkMethod(nif, supportsMulticast) && checkMethod(nif, isUp)) { Enumeration<InetAddress> addresses = nif.getInetAddresses(); while (addresses.hasMoreElements()) { InetAddress addr = addresses.nextElement(); // TODO: IpV6 support if (!(addr instanceof Inet6Address)) { ret.add(addr); } } } } return ret; }
private static InetAddress getLocalAddressFromNetworkInterfacesListeningOnPort(int pPort) { try { Enumeration<NetworkInterface> networkInterfaces; networkInterfaces = NetworkInterface.getNetworkInterfaces(); while (networkInterfaces.hasMoreElements()) { NetworkInterface nif = networkInterfaces.nextElement(); for (Enumeration<InetAddress> addrEnum = nif.getInetAddresses(); addrEnum.hasMoreElements(); ) { InetAddress interfaceAddress = addrEnum.nextElement(); if (!interfaceAddress.isLoopbackAddress() && checkMethod(nif, isUp) && isPortOpen(interfaceAddress, pPort)) { return interfaceAddress; } } } } catch (SocketException e) { return null; } return null; }
/** * Check whether the given interface supports multicast and is up * * @param pNif check whether the given interface supports multicast * @return true if multicast is supported and the interface is up */ public static boolean isMulticastSupported(NetworkInterface pNif) { return pNif != null && checkMethod(pNif, isUp) && checkMethod(pNif, supportsMulticast); }
/** * Check whether the given interface supports multicast and is up * * @param pNif check whether the given interface supports multicast * @return true if multicast is supported and the interface is up */ public static boolean isMulticastSupported(NetworkInterface pNif) { return pNif != null && checkMethod(pNif, isUp) && checkMethod(pNif, supportsMulticast); }
private static boolean useInetAddress(NetworkInterface networkInterface, InetAddress interfaceAddress) { return checkMethod(networkInterface, isUp) && checkMethod(networkInterface, supportsMulticast) && // TODO: IpV6 support !(interfaceAddress instanceof Inet6Address) && !interfaceAddress.isLoopbackAddress(); }
private static boolean useInetAddress(NetworkInterface networkInterface, InetAddress interfaceAddress) { return checkMethod(networkInterface, isUp) && checkMethod(networkInterface, supportsMulticast) && // TODO: IpV6 support !(interfaceAddress instanceof Inet6Address) && !interfaceAddress.isLoopbackAddress(); }
/** * Get all local addresses on which a multicast can be send * * @return list of all multi cast capable addresses */ public static List<InetAddress> getMulticastAddresses() throws SocketException { Enumeration<NetworkInterface> nifs = NetworkInterface.getNetworkInterfaces(); List<InetAddress> ret = new ArrayList<InetAddress>(); while (nifs.hasMoreElements()) { NetworkInterface nif = nifs.nextElement(); if (checkMethod(nif, supportsMulticast) && checkMethod(nif, isUp)) { Enumeration<InetAddress> addresses = nif.getInetAddresses(); while (addresses.hasMoreElements()) { InetAddress addr = addresses.nextElement(); // TODO: IpV6 support if (!(addr instanceof Inet6Address)) { ret.add(addr); } } } } return ret; }
/** * Get all local addresses on which a multicast can be send * * @return list of all multi cast capable addresses */ public static List<InetAddress> getMulticastAddresses() throws SocketException { Enumeration<NetworkInterface> nifs = NetworkInterface.getNetworkInterfaces(); List<InetAddress> ret = new ArrayList<InetAddress>(); while (nifs.hasMoreElements()) { NetworkInterface nif = nifs.nextElement(); if (checkMethod(nif, supportsMulticast) && checkMethod(nif, isUp)) { Enumeration<InetAddress> addresses = nif.getInetAddresses(); while (addresses.hasMoreElements()) { InetAddress addr = addresses.nextElement(); // TODO: IpV6 support if (!(addr instanceof Inet6Address)) { ret.add(addr); } } } } return ret; }
private static InetAddress getLocalAddressFromNetworkInterfacesListeningOnPort(int pPort) { try { Enumeration<NetworkInterface> networkInterfaces; networkInterfaces = NetworkInterface.getNetworkInterfaces(); while (networkInterfaces.hasMoreElements()) { NetworkInterface nif = networkInterfaces.nextElement(); for (Enumeration<InetAddress> addrEnum = nif.getInetAddresses(); addrEnum.hasMoreElements(); ) { InetAddress interfaceAddress = addrEnum.nextElement(); if (!interfaceAddress.isLoopbackAddress() && checkMethod(nif, isUp) && isPortOpen(interfaceAddress, pPort)) { return interfaceAddress; } } } } catch (SocketException e) { return null; } return null; }
private static InetAddress getLocalAddressFromNetworkInterfacesListeningOnPort(int pPort) { try { Enumeration<NetworkInterface> networkInterfaces; networkInterfaces = NetworkInterface.getNetworkInterfaces(); while (networkInterfaces.hasMoreElements()) { NetworkInterface nif = networkInterfaces.nextElement(); for (Enumeration<InetAddress> addrEnum = nif.getInetAddresses(); addrEnum.hasMoreElements(); ) { InetAddress interfaceAddress = addrEnum.nextElement(); if (!interfaceAddress.isLoopbackAddress() && checkMethod(nif, isUp) && isPortOpen(interfaceAddress, pPort)) { return interfaceAddress; } } } } catch (SocketException e) { return null; } return null; }