/** * Returns the outgoing network interface used by this socket. * * @throws SocketException if an error occurs. */ public NetworkInterface getNetworkInterface() throws SocketException { checkOpen(); int index = (Integer) impl.getOption(SocketOptions.IP_MULTICAST_IF2); if (index != 0) { return NetworkInterface.getByIndex(index); } return NetworkInterface.forUnboundMulticastSocket(); }
/** * Returns interface MAC by index. * * @param interfaceIndex interface index * @return interface IP by index */ private MacAddress getInterfaceMac(int interfaceIndex) { MacAddress macAddress = null; try { NetworkInterface networkInterface = NetworkInterface.getByIndex(interfaceIndex); macAddress = MacAddress.valueOf(networkInterface.getHardwareAddress()); } catch (Exception e) { log.debug("Error while getting Interface IP by index"); return macAddress; } return macAddress; }
/** * Returns interface MAC by index. * * @param interfaceIndex interface index * @return interface IP by index */ private MacAddress getInterfaceMac(int interfaceIndex) { MacAddress macAddress = null; try { NetworkInterface networkInterface = NetworkInterface.getByIndex(interfaceIndex); macAddress = MacAddress.valueOf(networkInterface.getHardwareAddress()); } catch (Exception e) { log.debug("Error while getting Interface IP by index"); return macAddress; } return macAddress; }
/** * Returns interface IP by index. * * @param interfaceIndex interface index * @return interface IP by index */ private Ip4Address getInterfaceIp(int interfaceIndex) { Ip4Address ipAddress = null; try { NetworkInterface networkInterface = NetworkInterface.getByIndex(interfaceIndex); Enumeration ipAddresses = networkInterface.getInetAddresses(); while (ipAddresses.hasMoreElements()) { InetAddress address = (InetAddress) ipAddresses.nextElement(); if (!address.isLinkLocalAddress()) { ipAddress = Ip4Address.valueOf(address.getAddress()); break; } } } catch (Exception e) { log.debug("Error while getting Interface IP by index"); return OspfUtil.DEFAULTIP; } return ipAddress; }
/** * Returns interface IP by index. * * @param interfaceIndex interface index * @return interface IP by index */ private Ip4Address getInterfaceIp(int interfaceIndex) { Ip4Address ipAddress = null; try { NetworkInterface networkInterface = NetworkInterface.getByIndex(interfaceIndex); Enumeration ipAddresses = networkInterface.getInetAddresses(); while (ipAddresses.hasMoreElements()) { InetAddress address = (InetAddress) ipAddresses.nextElement(); if (!address.isLinkLocalAddress()) { ipAddress = Ip4Address.valueOf(address.getAddress()); break; } } } catch (Exception e) { log.debug("Error while getting Interface IP by index"); return IsisConstants.DEFAULTIP; } return ipAddress; }
/** * Returns interface IP by index. * * @param interfaceIndex interface index * @return interface IP by index */ private static Ip4Address getInterfaceIp(int interfaceIndex) { Ip4Address ipAddress = null; try { NetworkInterface networkInterface = NetworkInterface.getByIndex(interfaceIndex); Enumeration ipAddresses = networkInterface.getInetAddresses(); while (ipAddresses.hasMoreElements()) { InetAddress address = (InetAddress) ipAddresses.nextElement(); if (!address.isLinkLocalAddress()) { ipAddress = Ip4Address.valueOf(address.getAddress()); break; } } } catch (Exception e) { log.debug("Error while getting Interface IP by index"); return OspfUtil.DEFAULTIP; } return ipAddress; }
/** * Returns interface IP by index. * * @param interfaceIndex interface index * @return interface IP by index */ private Ip4Address getInterfaceIp(int interfaceIndex) { Ip4Address ipAddress = null; try { NetworkInterface networkInterface = NetworkInterface.getByIndex(interfaceIndex); Enumeration ipAddresses = networkInterface.getInetAddresses(); while (ipAddresses.hasMoreElements()) { InetAddress address = (InetAddress) ipAddresses.nextElement(); if (!address.isLinkLocalAddress()) { ipAddress = Ip4Address.valueOf(address.getAddress()); break; } } } catch (Exception e) { log.debug("Error while getting Interface IP by index"); return IsisConstants.DEFAULTIP; } return ipAddress; }
final NetworkInterface n = NetworkInterface.getByIndex(index); if(log.isDebugEnabled()) { log.debug(String.format("Evaluate interface with %s index %d", n, index));
ipv6addr = (Inet6Address) fromIP; scopeID = ipv6addr.getScopeId(); intf = NetworkInterface.getByIndex(scopeID); pkt.setIngressInterface(intf); pkt.setSrcIP(fromIP);
/** * Returns the outgoing network interface used by this socket. * * @throws SocketException if an error occurs. */ public NetworkInterface getNetworkInterface() throws SocketException { checkOpen(); int index = (Integer) impl.getOption(SocketOptions.IP_MULTICAST_IF2); if (index != 0) { return NetworkInterface.getByIndex(index); } return NetworkInterface.forUnboundMulticastSocket(); }
socket.setSoTimeout(100); if (NETWORK_IF_TO_USE >= 0) socket.setNetworkInterface(NetworkInterface.getByIndex(NETWORK_IF_TO_USE));
/** * Returns the outgoing network interface used by this socket. * * @throws SocketException if an error occurs. */ public NetworkInterface getNetworkInterface() throws SocketException { checkOpen(); int index = (Integer) impl.getOption(SocketOptions.IP_MULTICAST_IF2); if (index != 0) { return NetworkInterface.getByIndex(index); } return NetworkInterface.forUnboundMulticastSocket(); }
/** * Returns the outgoing network interface used by this socket. * * @throws SocketException if an error occurs. */ public NetworkInterface getNetworkInterface() throws SocketException { checkOpen(); int index = (Integer) impl.getOption(SocketOptions.IP_MULTICAST_IF2); if (index != 0) { return NetworkInterface.getByIndex(index); } return NetworkInterface.forUnboundMulticastSocket(); }
/** * Returns the outgoing network interface used by this socket. * * @throws SocketException if an error occurs. */ public NetworkInterface getNetworkInterface() throws SocketException { checkOpen(); int index = (Integer) impl.getOption(SocketOptions.IP_MULTICAST_IF2); if (index != 0) { return NetworkInterface.getByIndex(index); } return NetworkInterface.forUnboundMulticastSocket(); }
/** * Returns the outgoing network interface used by this socket. * * @throws SocketException if an error occurs. */ public NetworkInterface getNetworkInterface() throws SocketException { checkOpen(); int index = (Integer) impl.getOption(SocketOptions.IP_MULTICAST_IF2); if (index != 0) { return NetworkInterface.getByIndex(index); } return NetworkInterface.forUnboundMulticastSocket(); }
/** * Returns the outgoing network interface used by this socket. * * @throws SocketException if an error occurs. */ public NetworkInterface getNetworkInterface() throws SocketException { checkOpen(); int index = (Integer) impl.getOption(SocketOptions.IP_MULTICAST_IF2); if (index != 0) { return NetworkInterface.getByIndex(index); } return NetworkInterface.forUnboundMulticastSocket(); }
socket.setSoTimeout(100); if (NETWORK_IF_TO_USE >= 0) socket.setNetworkInterface(NetworkInterface.getByIndex(NETWORK_IF_TO_USE));
NetworkInterface ni = NetworkInterface.getByIndex (send_req.getNetworkInterfaceIndex()); Enumeration<InetAddress> inetAddresses = ni.getInetAddresses(); while (inetAddresses.hasMoreElements()) {
while (itrInterface.hasNext()) { IsisInterface isisInterface = itrInterface.next(); interfaceName = NetworkInterface.getByIndex(isisInterface.interfaceIndex()).getName(); Set<MacAddress> getNeighborList = isisInterface.neighbors(); for (MacAddress mac : getNeighborList) {
break; interfaceName = NetworkInterface.getByIndex(isisInterface.interfaceIndex()).getName(); print("%-20s%-20s%-20s%-20s\n", interfaceName, isisInterface.areaAddress(), networkType, circuitType);