亚洲av成人无遮挡网站在线观看,少妇性bbb搡bbb爽爽爽,亚洲av日韩精品久久久久久,兔费看少妇性l交大片免费,无码少妇一区二区三区

Chinaunix

標(biāo)題: 請(qǐng)教 [打印本頁(yè)]

作者: dou    時(shí)間: 2003-01-17 16:07
標(biāo)題: 請(qǐng)教
請(qǐng)問(wèn),如何獲取本機(jī)的IP地址?
作者: elgs    時(shí)間: 2003-01-17 19:33
標(biāo)題: 請(qǐng)教
InetAddress address = InetAddress.getLocalHost();
System.out.println("Local address:  " + address.getHostAddress());
System.out.println("Local hostname: " + address.getHostName());
作者: elgs    時(shí)間: 2003-01-17 23:22
標(biāo)題: 請(qǐng)教
不知如果主機(jī)有多個(gè)ip地址如何處理, 請(qǐng)問(wèn)版主?
作者: cinc    時(shí)間: 2003-01-19 17:11
標(biāo)題: 請(qǐng)教
Try this:

import java.net.InetAddress;

public class Main{
    public static void main(String args[]) throws Exception{
        InetAddress localhost = InetAddress.getLocalHost();
        InetAddress[] addresses = InetAddress.getAllByName(localhost.getHostName());
        for (int i=0; i<addresses.length; i++){
            System.out.println (addresses.getHostAddress());
        }
    }
}






歡迎光臨 Chinaunix (http://72891.cn/) Powered by Discuz! X3.2