I outlined some issues in my last post on using CFHTTP and paying attention to connection issues. Muse reader Scott Pinkston posted a nice snippet of code that allows you to see what IP address is used to resolve a given domain name. Here it is complete with the function call (getHostAddress()) that gives you the IP address:
In fact, if you are on a windows domain and using "friendly" names (names that come without fully qualified domain syntax) this code can resolve those as well, as in this example:
I suppose that Java uses the underlying stack and windows domains typically use windows DNS which are capable of resolving these types of friendly names as well as fully qualified names.
Anyway, this approach came in handy recently when file access to a UNC path (i.e. \\servername\sharename) was throwing a nondescript error. The error could have been permissions or name resolution (we weren't sure). Using the code above to resolve the "servername" portion of the UNC path we were able to test resolution to make sure it was returning the correct IP.