Results 1 to 2 of 2

Thread: Obtain Real-Time (NON-CACHED) IP array?

  1. #1
    Guest

    Question

    How do I obtain the real-time multiple IP addresses for a given machine?

    I've used:
    InetAddress ip = InetAddress.getLocalHost();//Expect to remain constant
    InetAddress mip[] = InetAddress.getAllByName( ip.getHostName() );//Expect to change

    When the "multiple IP address array" changes (as when a pc dials an ISP obtaining a dynamically assigned IP) and I call the method again to update mip, I still get the original results. I've found out that there is a caching mechanism in the private method "getAllByName0" which is called by "getAllByName". Perhaps there is a way to flag caching on/off before my call to the public method "getAllByName".

    I asked this at http://www.hotdispatch.com/home?aff=75141470 and a reply looked promising:
    "Using InetAddressCachePolicy.setIfNotSet InetAddressCachePolicy.FOREVER);
    Before you setup SecurityManager.", but I could never find the class "InetAddressCachePolicy" and the person never replied again. I couldn't find the class at java.sun.com either.

  2. #2
    Guest

    Exclamation For anyone interested in the solution

    It looks like it is a M$ problem.
    http://support.microsoft.com/support.../Q273/0/27.ASP

    Unfortunately that was the underlying platform.

    I'll try it on non-Windows Linux to verify.

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