如题,我想获取本机ip,在网上找了很多,有的获取了几个ip,有个还获取的个错误的东西:(0:0:0:0:0:0:0)
2条回答 默认 最新
馨渡 2017-08-08 06:52关注//获取终端Ip
public static String GetIp() {
InetAddress ia = null;
try {
ia = InetAddress.getLocalHost();
String localip = ia.getHostAddress();
return localip;
} catch (Exception e) {
return null;
}
}解决评论 打赏 举报无用 1