发布网友 发布时间:2022-04-24 09:45
共2个回答
热心网友 时间:2022-06-18 15:58
Android studio下面Terminal,用ipconfig命令查看ip地址。
热心网友 时间:2022-06-18 15:58
/**
* 获取ip地址
* @return
*/
public static String getHostIP() {
String hostIp = null;
try {
Enumeration nis = NetworkInterface.getNetworkInterfaces();
InetAddress ia = null;
while (nis.hasMoreElements()) {
NetworkInterface ni = (NetworkInterface) nis.nextElement();
Enumeration<InetAddress> ias = ni.getInetAddresses();
while (ias.hasMoreElements()) {
ia = ias.nextElement();