CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Guest

    DNS through java

    I am behind a proxy and want to find the IP no. of an Internet addresses.
    I wrote the following :

    public class DNS
    { public static void main(String args[])
    { System.getProperties().put( "proxySet", "true" );
    System.getProperties().put( "proxyHost", "proxy compu." );
    System.getProperties().put( "proxyPort", port );
    try
    { InetAddress add=InetAddress.getLocalHost();
    String name="www.yahoo.com";
    InetAddress newad=InetAddress.getByName(name);
    System.err.println("IP no. of "+name+" is : "+newad);
    }
    catch(Exception e)
    { e.printStackTrace(); }
    }
    }

    This is giving :
    java.net.UnknownHostException: www.yahoo.com

    This was somewhat expected. But is there a way by which I can use a DNS server
    in my network directly through the prog. and get my reply ? I know the IP no.
    of the DNS server.
    Regards. Samik.

    Please Email a copy of reply to [email protected]


  2. #2
    Join Date
    Aug 1999
    Location
    Michigan, USA
    Posts
    4

    Re: DNS through java

    There is a package available through the CodeGuru web site that will do DNS functions for you. I assume that it will work for your purposes. I have not tried it myself. Check it out at
    http://www.codeguru.com/java/articles/334.shtml



Posting Permissions

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





Click Here to Expand Forum to Full Width

Featured