如何在傳遞一個主機名的以下代碼塊中傳遞多個「主機名」?可能嗎?如何在「InetAddress」方法中傳遞「主機名」數組而不是傳遞單個主機名
private static void run() {
String host = "www.google.com";
try {
inetAddress = InetAddress.getAllByName(host);
String all = "";
for (int i = 0; i < inetAddress.length; i++) {
all = all + String.valueOf(i) + " : " + inetAddress[i].toString() + "\n";
Log.d("IPADDR", "IP Address : " + all);
prefs.sethostIPaddress(context, all); //Setting HostIP Address in Preference File
}
}
catch (UnknownHostException e) {
e.printStackTrace();
}
}
三江源傢伙,薩米特和Wizche ...它的工作:d乾杯 – 2013-02-14 10:54:42
您的歡迎:) – 2013-02-14 11:48:43