When I try to get the hostname of my machine from the code, I'm using the following:
address = InetAddress.getLocalHost().getCanonicalHostName();
The above throws an excpetion (UnknownHostException) if the host is composed of dots (for example "My.Host") or _.
I still am interested in the above host names. Is there any other option to fetch them?