0
當手機設備連接3G網絡時,如何判斷如何判斷Android設備的IP地址是否公開?如何判斷Android設備的IP地址是否公開
public static InetAddress getLocalIpAddress() {
try {
for (Enumeration<NetworkInterface> en = NetworkInterface.getNetworkInterfaces(); en.hasMoreElements();) {
NetworkInterface intf = en.nextElement();
for (Enumeration<InetAddress> enumIpAddr = intf.getInetAddresses(); enumIpAddr.hasMoreElements();) {
InetAddress address = enumIpAddr.nextElement();
return address;
}
}
} catch (SocketException ex) {
Log.e(DEBUG_TAG, ex.toString());
}
return null;
}
你在做什麼? – Falmarri 2010-12-08 00:44:25