Package java.net

Examples of java.net.NetworkInterface


        }
       
        Enumeration e = NetworkInterface.getNetworkInterfaces();

        while (e.hasMoreElements()) {
            NetworkInterface netface = (NetworkInterface) e.nextElement();
            if (log.isInfoEnabled())
                log.info("Net interface: " + netface.getName());

            Enumeration e2 = netface.getInetAddresses();

            while (e2.hasMoreElements()) {
                InetAddress ip = (InetAddress) e2.nextElement();
                if (log.isInfoEnabled())
                    log.info("IP address: " + ip.toString());
View Full Code Here


                 */
                if (getTunnelType() == TransportType.REMOTE_TUNNEL_ID) {
                    if (!sourceInterface.trim().equals("0.0.0.0") && !sourceInterface.trim().equals("127.0.0.2"))
                        try {
                            InetAddress addr = InetAddress.getByName(sourceInterface);
                            NetworkInterface nif = NetworkInterface.getByInetAddress(addr);
                            if (nif == null) {
                                throw new Exception();
                            }
                        } catch (Exception e) {
                            errs.add(Globals.ERROR_KEY, new ActionMessage(
View Full Code Here

      // not available
      return null;
    }
    StringBuffer b = new StringBuffer();
    while (e1.hasMoreElements()) {
      NetworkInterface ni = (NetworkInterface) e1.nextElement();
      StringBuffer b1 = getMACAddressDescriptor(ni);
      StringBuffer b2 = getInetAddressDescriptor(ni);
      StringBuffer b3 = new StringBuffer();
      if (b1 != null) {
        b3.append(b1);
View Full Code Here

                if (this.log.isFine()) this.log.logFine("Trying to determine IP address of interface '" + interfaceName + "'.");                   

                final Enumeration<NetworkInterface> interfaces = NetworkInterface.getNetworkInterfaces();
                if (interfaces != null) {
                    while (interfaces.hasMoreElements()) {
                        final NetworkInterface interf = interfaces.nextElement();
                        if (interf.getName().equalsIgnoreCase(interfaceName)) {
                            final Enumeration<InetAddress> addresses = interf.getInetAddresses();
                            if (addresses != null) {
                                while (addresses.hasMoreElements()) {
                                    final InetAddress address = addresses.nextElement();
                                    if (address instanceof Inet4Address) {
                                        hostName = address.getHostAddress();
View Full Code Here

            InetAddress inetAddress;
            ArrayList<String> hosts = new ArrayList<String>();
            Enumeration<NetworkInterface> ifaces =
                NetworkInterface.getNetworkInterfaces();
            while (ifaces.hasMoreElements()) {
                NetworkInterface iface = ifaces.nextElement();
                Enumeration<InetAddress> addrs = iface.getInetAddresses();
                while (addrs.hasMoreElements()) {
                    inetAddress = addrs.nextElement();
                    if (inetAddress instanceof Inet4Address)     
                        hosts.add(inetAddress.getHostAddress());
                }
View Full Code Here

          connectionlessBootstrap.setOption("broadcast", true);
          connectionlessBootstrap.setPipelineFactory(factory);
          datagramChannel = (DatagramChannel)
          connectionlessBootstrap.bind(new InetSocketAddress(mcastGroupPort));
          multicastAddress = new InetSocketAddress(mcastGroupIp, mcastGroupPort);
          NetworkInterface networkInterface =
          NetworkInterface.getByInetAddress(InetAddress.getByName(bindAddress));
          datagramChannel.joinGroup(multicastAddress, networkInterface);
          init = true;
  }
View Full Code Here

        {
          Enumeration<NetworkInterface> e = NetworkInterface.getNetworkInterfaces();

          while (e.hasMoreElements())
          {
            NetworkInterface ne = (NetworkInterface) e.nextElement();
            Enumeration<InetAddress> e2 = ne.getInetAddresses();

            while (e2.hasMoreElements())
            {
              InetAddress ia = (InetAddress) e2.nextElement();
View Full Code Here

        }
        try {
            InetAddress dest = InetAddress.getByName(hostname);
            Enumeration en = NetworkInterface.getNetworkInterfaces();
            while (en.hasMoreElements()) {
                NetworkInterface iface = (NetworkInterface) en.nextElement();
                Enumeration ine = iface.getInetAddresses();
                while (ine.hasMoreElements()) {
                    InetAddress address = (InetAddress) ine.nextElement();
                    if (address.equals(dest)) {
                        isSameMachine = true;
                    }
View Full Code Here

        }
       
        Enumeration<NetworkInterface> interfaces = NetworkInterface.getNetworkInterfaces();
        int count = 0;
        while (interfaces.hasMoreElements()) {
            NetworkInterface networkInterface = interfaces.nextElement();
            if (!networkInterface.isUp() || networkInterface.isLoopback()) {
                continue
            }
            count++;
        }
        if (count == 0) {
View Full Code Here

        }
       
        Enumeration<NetworkInterface> interfaces = NetworkInterface.getNetworkInterfaces();
        int count = 0;
        while (interfaces.hasMoreElements()) {
            NetworkInterface networkInterface = interfaces.nextElement();
            if (!networkInterface.isUp() || networkInterface.isLoopback()) {
                continue
            }
            count++;
        }
        if (count == 0) {
View Full Code Here

TOP

Related Classes of java.net.NetworkInterface

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.