<ruby id="bdb3f"></ruby>

    <p id="bdb3f"><cite id="bdb3f"></cite></p>

      <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
        <p id="bdb3f"><cite id="bdb3f"></cite></p>

          <pre id="bdb3f"></pre>
          <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

          <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
          <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

          <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                <ruby id="bdb3f"></ruby>

                合規國際互聯網加速 OSASE為企業客戶提供高速穩定SD-WAN國際加速解決方案。 廣告
                ~~~ package com.sjf; import java.net.Inet4Address; import java.net.Inet6Address; import java.net.InetAddress; import java.net.NetworkInterface; import java.net.UnknownHostException; import java.util.Enumeration; /** * * @author sjf0115 * */ public class InetAddressExample { public static void main(String[] args) { // Get the network interfaces and associated for this host try { NetworkInterface networkInterface = null; // 獲得該主機每一個接口的信息 Enumeration<NetworkInterface> interfaceList = NetworkInterface.getNetworkInterfaces(); if(interfaceList == null) { System.out.println("--No interfaces found--"); }//if else { while(interfaceList.hasMoreElements()) { networkInterface = interfaceList.nextElement(); // 接口名稱 System.out.println("Interface->"+networkInterface.getName()); // 獲取與接口相關聯的地址 根據主機的不同配置 可能包含IPV4或IPV6地址 Enumeration<InetAddress> inetAddressList = networkInterface.getInetAddresses(); if(inetAddressList == null) { System.out.println("--No address for this NetworkInterface--"); }//if else { InetAddress address = null; while(inetAddressList.hasMoreElements()) { address = inetAddressList.nextElement(); // 對每個地址進行檢測判斷屬于哪個IP地址子類 System.out.print(address instanceof Inet4Address ? "(v4)" : (address instanceof Inet6Address ? "(v6)" : "(?)")); // 打印IP地址 System.out.println(":"+address.getHostAddress()); }//while } }//while } } catch (Exception e) { } String host = "www.baidu.com"; try { // 一個名字可能關聯了多個數字地址 該方法返回一組與給定主機名相關聯的所有地址的實例 InetAddress[] addressesList = InetAddress.getAllByName(host); for(InetAddress address : addressesList) { System.out.println(address.getHostName()+" "+address.getHostAddress()); }//for // Determines the IP address of a host, given the host's name. InetAddress address2 = InetAddress.getByName(host); System.out.println(address2.getHostName()+" "+address2.getHostAddress()); // Returns the local host. InetAddress address3 = InetAddress.getLocalHost(); System.out.println(address3.getHostName()+" "+address3.getHostAddress()); } catch (UnknownHostException e) { e.printStackTrace(); } } } ~~~ ![這里寫圖片描述](https://box.kancloud.cn/2016-03-18_56eba2a59cbdb.jpg "") ![這里寫圖片描述](https://box.kancloud.cn/2016-03-18_56eba2a5c6479.jpg "") ![這里寫圖片描述](https://box.kancloud.cn/2016-03-18_56eba2a5f1639.jpg "") ![這里寫圖片描述](https://box.kancloud.cn/2016-03-18_56eba2a623b36.jpg "") ![這里寫圖片描述](https://box.kancloud.cn/2016-03-18_56eba2a64e301.jpg "")
                  <ruby id="bdb3f"></ruby>

                  <p id="bdb3f"><cite id="bdb3f"></cite></p>

                    <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
                      <p id="bdb3f"><cite id="bdb3f"></cite></p>

                        <pre id="bdb3f"></pre>
                        <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

                        <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
                        <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

                        <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                              <ruby id="bdb3f"></ruby>

                              哎呀哎呀视频在线观看