0

如果值包含 http 或 https,我会在以下代码中收到 unknownhost 异常。但如果 url 以 www 开头,它会给出结果。

InetAddress.getByName(value)

为什么会这样?

4

1 回答 1

1

Because http(or https) is the protocol, and not part of the name.

InetAddress.getByName(value) works with names only, not URLs.

于 2016-06-23T11:01:21.183 回答