beanshell : InetAddressTest.bsh
source("/sdcard/com.googlecode.bshforandroid/extras/bsh/android.bsh"); a = Android(); urlName = a.call("dialogGetInput","Inet Address Test","Input URL:").get("result"); print(urlName); try { if (urlName != null){ String host = urlName; InetAddress[] addresses = InetAddress.getAllByName(host); for (InetAddress a : addresses) print(a); } else { InetAddress localHostAddress = InetAddress.getLocalHost(); print(localHostAddress); } } catch (Exception e){ print(e); }
参考: Core Java 2 Volume II ( 7th Edition) v2ch3