AP에 연결되었을 때, 연결된 AP의 주소가 필요 합니다.


그런데 구글링하였을때, AP 주소 가져오는 코드나, 휴대폰의 IP 주소 가져오는 코드나 같던데


AP에 연결되면 휴대폰 IP는 AP의 IP로 사용되서 쓰는건가요?;



public static String getLocalIpAddressString()

{

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())

{

return inetAddress.getHostAddress().toString();

}

}

}

} catch (Exception ex) {

Log.e("IPADDRESS", ex.toString());

}

return null;

}