Jason B Herald

Feed Rss

Domain Lookup

09.19.2009, Java, by .

Here is some code to do domain lookup in java (nslookup style):

Hashtable env = new Hashtable();
env.put(“java.naming.factory.initial”, “com.sun.jndi.dns.DnsContextFactory”);
DirContext ictx = new InitialDirContext(env);
Attributes attrs = ictx.getAttributes(“gmail.com”, new String[]{“MX”});
Attribute attr = attrs.get(“MX”);

Leave a Reply