Results 1 to 2 of 2
  1. #1
    rlzyoner is offline Member
    Join Date
    Jul 2008
    Posts
    7
    Rep Power
    0

    Default Return onyl 1 MX record if numerous exist

    Hi there,

    I have wrote the code below to perform an MXLookup on a give host.
    Is there a way to return only 1 (Preferably the first) mx record, rather than all that exist.

    Reason being I want to use a returned mx record for another method

    Java Code:
    public static void getMX(String domainName) throws NamingException {
    		InitialDirContext ictx = new InitialDirContext();
    		Attributes attributes = ictx.getAttributes("dns:/" + domainName, new String[] {"MX"});
    		Attribute attributeMX = attributes.get("MX");
    		System.out.println(attributeMX);
    	}
    Thanks

  2. #2
    rlzyoner is offline Member
    Join Date
    Jul 2008
    Posts
    7
    Rep Power
    0

    Default

    Just figured it out.

    Attribute has a get() method which returns 1 of the values.

Similar Threads

  1. Can't record sound
    By bozovilla in forum Java Applets
    Replies: 12
    Last Post: 08-04-2008, 04:57 PM
  2. Replies: 3
    Last Post: 11-03-2007, 02:58 PM
  3. selecting a record in database
    By ramachandran in forum New To Java
    Replies: 0
    Last Post: 10-25-2007, 08:06 AM
  4. Replies: 2
    Last Post: 07-02-2007, 07:48 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •