JAVA获得域名的IP地址计算机等级考试
文章作者 100test 发表时间 2010:01:28 11:54:08
来源 100Test.Com百考试题网
import java.net.InetAddress.
import java.net.UnknownHostException.
public class TestInetAddress {
InetAddress myIpAddress = null.
InetAddress[] myServer = null.
public static void main(String args[]) {
TestInetAddress address = new TestInetAddress().
System.out.println("Your host IP is: " address.getLocalhostIP()).
String domain = "www.163.com".
System.out.println("The server domain name is: " domain).
InetAddress[] array = address.getServerIP(domain).
int count=0.
for(int i=1. i