dnsjava是DNS协议的一个Java开源实现。
示例代码:
Record [] records = new Lookup("gmail.com", Type.MX).run(); for (int i = 0; i < records.length; i++) { MXRecord mx = (MXRecord) records[i]; System.out.println("Host " + mx.getTarget() + " has preference ", mx.getPriority()); }