* @param hostIp
* @return The resolved DNS name.
* @throws IOException
*/
public static String resolveAddress(String hostIp) throws IOException {
Resolver res = new ExtendedResolver();
res.setTimeout(5); // seconds
Name name = ReverseMap.fromAddress(hostIp);
int type = Type.PTR;
int dclass = DClass.IN;
Record rec = Record.newRecord(name, type, dclass);
Message query = Message.newQuery(rec);
Message response = res.send(query);
Record[] answers = response.getSectionArray(Section.ANSWER);
if (answers.length == 0)
return hostIp;
else {