How can I look up a DNS MX record for a given server in Java?

牧云@^-^@ 提交于 2019-12-01 17:44:48

问题


Anybody knows how to get MX address (from for example gmail.com) in java using standard libraries? Or do I need to download external one?

I'm using netbeans if it can be helpful (if it provides something for this).


回答1:


I was also searching for standart lib for this in java. Unsuccessful.

Then I have used dnsjava.

private Record[] lookupMxRecords(final String domainPart) throw TextParseException
{
    final Lookup dnsLookup = new Lookup(domainPart, Type.MX);
    return dnsLookup.run();
}


来源:https://stackoverflow.com/questions/14042742/how-can-i-look-up-a-dns-mx-record-for-a-given-server-in-java

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!