I just posted a question here: How to get the IP address for remote host using Java
The following code worked with me in the couple of domain names that I tested.
InetAddress inetAddress = InetAddress.getByName("http://www.google.com");
String ipAddress = inetAddress.getHostAddress().toString()'
System.out.println(ipAddress );//prints 66.152.109.61
But I am in doubt. How to get the IP without creating a socket?.
So, before I go to further stages in my code, I just need to make sure from one point: Do I need to create socket in order to get the IP address for a remote host ?
No there is no need to create socket from your code, getHostAddress will open a socket in the back ground and call stub resolver using the DNS configuration on your machine to resolve the name and if you wireshark the traffic you will find that it went and query your dns server for the hostname