Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 678759
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T01:11:06+00:00 2026-05-14T01:11:06+00:00

is there a Java version of the PHP function checkdnsrr ?

  • 0

is there a Java version of the PHP function checkdnsrr?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-14T01:11:07+00:00Added an answer on May 14, 2026 at 1:11 am

    If you just want any IP address you can use InetAddress (though the API doesn’t specify what types of hosts this will match):

    InetAddress[] addresses = java.net.InetAddress.getAllByName(String host)
    

    You can then use getAddress() for the raw bytes of the IP address or getHostAddress() for a formatted String representation of the IP address.

    If you are looking for a specific type of record (such as MX records) here is a snippet I found on this webpage

    import  java.util.Hashtable;
    import  javax.naming.*;
    import  javax.naming.directory.*;
    
    public class MXLookup {
      public static void main( String args[] ) {
        if( args.length == 0 ) {
          System.err.println( "Usage: MXLookup host [...]" );
          System.exit( 99 );
        }
        for( int i = 0; i < args.length; i++ ) {
          try {
            System.out.println( args[i] + " has " +
              doLookup( args[i] ) + " mail servers" );
          }
          catch( Exception e ) {
            System.out.println(args[i] + " : " + e.getMessage());
          }
        }
      }
    
      static int doLookup( String hostName ) throws NamingException {
        Hashtable env = new Hashtable();
        env.put("java.naming.factory.initial",
                "com.sun.jndi.dns.DnsContextFactory");
        DirContext ictx = new InitialDirContext( env );
        Attributes attrs = 
           ictx.getAttributes( hostName, new String[] { "MX" });
        Attribute attr = attrs.get( "MX" );
        if( attr == null ) return( 0 );
        return( attr.size() );
      }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Short version: In pure Java EE 6, is there something like Spring's Authentication Processing
Is there any Java function or util class which does rounding this way: func(3/2)
Is there a java version of matlab's colon operator or linspace? For instance, I'd
Is there Java or .NET version of R? (like Jython / IronPython for the
Is there a simplistic solution to obtain the version of Java running on a
In java there is an optimal buffer size of 32 Kb which is based
In Java there is a nice library class java.util.Stack which implements push and pop
In Java there are methods to go about scanning the classpath/all classes/within a package
Is there any Java lib that allows me to download web pages recursively given
Is there a java library or framework (other than the javax.comm provided by Sun)

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.