Hey

Please explain a bit more. I'm not sure I understand what you want
(use a bit more detail).

Thanks,
Q

On 6/30/08, Laxmilal Menaria <[EMAIL PROTECTED]> wrote:
> ok.. thanks, But I want to use existing HttpClient object instead of
>  created new one, I think If I hosted "http://laxmilal.com"; on 3-4
>  server, so I will get new IP for all objects, thats why I need to use
>  existing object.
>
>
>  Laxmilal
>
>
>  On Mon, Jun 30, 2008 at 6:00 PM, Quintin Beukes <[EMAIL PROTECTED]> wrote:
>  > Hey,
>  >
>  > Well, there are 2 techniques, first is to simply use the
>  > InetAddress.getByName() method which will query the system's
>  > configured DNS server (recommended in general). Second technique is
>  > used when you wish to query a specific DNS server (not the one used by
>  > the system).
>  >
>  > The first technique is done like this:
>  >    InetAddress ip = InetAddress.getByName("dev.junkmail.co.za");
>  >    System.out.println("IP: " + ip.getHostAddress());
>  >
>  > Over here, the "InetAddress ip" object has a few methods for
>  > retrieving the IP address. Have a look at the JavaDoc to learn more.
>  >
>  > The second technique is done like this:
>  >
>  >    Hashtable env = new Hashtable();
>  >    env.put(Context.INITIAL_CONTEXT_FACTORY,
>  > "com.sun.jndi.dns.DnsContextFactory");
>  >    env.put(Context.PROVIDER_URL, "dns://10.0.0.1/");
>  >    DirContext ictx = new InitialDirContext(env);
>  >    Attributes attrs1 = ictx.getAttributes("www.junkmail.co.za", new
>  > String[] {"A"});
>  >
>  >    // get first IP
>  >    System.out.println("First IP: " + attrs1.get("A").get().toString());
>  >
>  >    // get all IP addresses
>  >    NamingEnumeration nameEnum = attrs1.get("A").getAll();
>  >    while (nameEnum.hasMore())
>  >    {
>  >      Object aRecord = nameEnum.next();
>  >      System.out.println("A record: " + aRecord.toString());
>  >    }
>  >
>  > Over here you will see that you can either query for only the first
>  > record/IP, or enumerate through all of them. You will have to handle
>  > some exceptions with this technique (like NoSuchElementException if an
>  > IP/A record couldn't be found, and NamingException for misc errors
>  > like DNS connection failures).
>  >
>  > hope this helps,
>  > Quintin
>  >
>  > On 6/30/08, Laxmilal Menaria <[EMAIL PROTECTED]> wrote:
>  >> Hello,
>  >>
>  >>  I have created a sample to check the my webpage status, now want to
>  >>  get  IP address of "http://laxmilal.com";, so is there are any method
>  >>  to get HOST IP ?
>  >>
>  >>   method = new GetMethod("http://laxmilal.com";);
>  >>   int statusCode = httpClient.executeMethod(secureHostConfig, method);
>  >>
>  >>
>  >>  Please let me know.
>  >>
>  >>  Thanks
>  >>  Laxmilal
>  >>
>  >>  ---------------------------------------------------------------------
>  >>  To unsubscribe, e-mail: [EMAIL PROTECTED]
>  >>  For additional commands, e-mail: [EMAIL PROTECTED]
>  >>
>  >>
>  >
>  >
>  > --
>  > Quintin Beukes
>  >
>  > ---------------------------------------------------------------------
>  > To unsubscribe, e-mail: [EMAIL PROTECTED]
>  > For additional commands, e-mail: [EMAIL PROTECTED]
>  >
>  >
>
>  ---------------------------------------------------------------------
>  To unsubscribe, e-mail: [EMAIL PROTECTED]
>  For additional commands, e-mail: [EMAIL PROTECTED]
>
>


-- 
Quintin Beukes

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to