Package org.xbill.DNS

Examples of org.xbill.DNS.Lookup.run()


              //�ؿ�ר��
              String email = mail.getRecipients(RecipientType.TO)[0].toString();
              String domain_name = parseDomain(email);
              //TODO: ʵ�������Ļ���,�ӿ�����ٶ�
              Lookup lookup = new Lookup(domain_name, Type.MX);
                  lookup.run();
              if (lookup.getResult() != Lookup.SUCCESSFUL){
                log("ERROR: " + lookup.getErrorString() + " when lookup MX record of " + email);
                continue;
              }
              Record[] answers = lookup.getAnswers();
View Full Code Here


          mailMessage.setFrom(new InternetAddress("javayou@gmail.com","Winter Lau"));
         
          String mail_postfix = mailaddr.substring(mailaddr.indexOf('@')+1);
          //System.out.println("mail postfix is " + mail_postfix);
          Lookup lookup = new Lookup(mail_postfix, Type.MX);
          lookup.run();
      if (lookup.getResult() != Lookup.SUCCESSFUL){
        System.out.println(" " + lookup.getErrorString());
        return;
      }
      Record[] answers = lookup.getAnswers();
View Full Code Here

  public static void main(String[] args) throws Exception {
    int type = Type.MX;
    for (int i = 0; i < args.length; i++) {
      Lookup l = new Lookup(args[i], type);
      l.run();
      printAnswer(args[i], l);
      System.out.println("===============================");
    }
  }
}
View Full Code Here

            log.debug("Start "+recordTypeDescription+"-Record lookup for : " + request.getHostname());

            Lookup query = new Lookup(request.getHostname(), dnsJavaType);
            query.setResolver(resolver);

            Record[] rr = query.run();
            int queryResult = query.getResult();
           

            if (queryResult == Lookup.TRY_AGAIN) {
                throw new TimeoutException(query.getErrorString());
View Full Code Here

            log.debug("Start "+recordTypeDescription+"-Record lookup for : " + hostname);

            Lookup.getDefaultResolver().setTimeout(timeOut);
            Lookup query = new Lookup(hostname, dnsJavaType);

            Record[] rr = query.run();
            int queryResult = query.getResult();

            if (queryResult == Lookup.TRY_AGAIN) {
                throw new TimeoutException();
            }
View Full Code Here

                            lookup = new Lookup(hostname);
                        } catch (TextParseException e) {
                            throw new UnknownHostException(hostname);
                        }

                        lookup.run();

                        if (lookup.getResult() == Lookup.SUCCESSFUL) {
                            final Record[] records = lookup.getAnswers();
                            final int recordCount = records.length;
View Full Code Here

            try {
                lookup = new Lookup(queryDomain, Type.TXT);
            } catch (TextParseException e) {
                throw new RuntimeException(e);
            }
            Record[] records = lookup.run();
            if (lookup.getResult() != Lookup.SUCCESSFUL
                    && lookup.getResult() != Lookup.TYPE_NOT_FOUND) {
                logger.warn("Error while looking up TXT record for "
                        + "address {} in DNSBL {}: {}", new Object[] { address,
                        domain, lookup.getErrorString() });
View Full Code Here

        return addresses;
    }

    private Record[] queryAddressRecords() throws SendException {
        Lookup lookup = new Lookup(name);
        Record[] records = lookup.run();
        switch (lookup.getResult()) {
        case Lookup.SUCCESSFUL:
            return records;
        case Lookup.TYPE_NOT_FOUND:
            throw new SendException("Host " + name + " has no address record ("
View Full Code Here

                    } else {
                        lookup = new Lookup(dnsName);
                    }
                }

                lookup.run();
                if (lookup.getAnswers() != null) {
                    exchange.getOut().setBody(lookup.getAnswers());
                } else {
                    exchange.getOut().setBody(lookup.getErrorString());
                }
View Full Code Here

    int type = Type.A;
    String domainName = "www.twitter.com";
    for (int i = 0; i < 1; i++) {
      Thread.sleep(200);
      Lookup l = new Lookup(domainName, type);
      l.run();
      recordAnswer(domainName, l);
    }
  }

}
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.