怎么能找到wifi接口上的LAN IP地址(不是外部ip)?
谢谢,
解决方法 NetworkInterface将帮助您:String ipAddress = null;try { for (Enumeration<NetworkInterface> en = NetworkInterface.getNetworkInterfaces(); en.hasMoreElements();) { NetworkInterface intf = en.nextElement(); for (Enumeration<InetAddress> enumIpAddr = intf.getInetAddresses(); enumIpAddr.hasMoreElements();) { InetAddress inetAddress = enumIpAddr.nextElement(); if (!inetAddress.isLoopbackAddress()) { ipAddress = inetAddress.getHostAddress().toString(); } } }} catch (SocketException ex) {}总结
以上是内存溢出为你收集整理的如何找到Android设备的局域网IP地址?全部内容,希望文章能够帮你解决如何找到Android设备的局域网IP地址?所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)