I am getting unknownhost exception in the following code if the value contains http or https. But it gives result if the url begins with www.
InetAddress.getByName(value)
Why is it so?
I am getting unknownhost exception in the following code if the value contains http or https. But it gives result if the url begins with www.
InetAddress.getByName(value)
Why is it so?
Because http
(or https
) is the protocol, and not part of the name.
InetAddress.getByName(value)
works with names only, not URLs.