package cn.net.test;

import java.net.InetAddress;
import java.net.UnknownHostException;

public class NsLookup2 {
	
	public static void main(String[] args) {
		try {
			String name = "zs.jingpai.com";
			InetAddress[] addresses = InetAddress.getAllByName(name);
			for (int i = 0; i < addresses.length; i++) {
				System.out.println(name +":"+ addresses[i].getHostAddress());
			}
		} catch (UnknownHostException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		
	}
/*	static public void main(String[] args) {  
try {  
		            String name = args[0];  
		            InetAddress[] addresses = InetAddress.getAllByName(name);  
		            for (int i = 0; i < addresses.length; i++) {  
		                  
		                System.out.println(name + "[" + i + "]: "  
		                        + addresses[i].getHostAddress());  
		            }  
		        } catch (UnknownHostException uhe) {  
		            System.err.println("Unable to find: " + args[0]);  
		        } */

}
