0

我无法通过 HttpsURLConnection 连接到 IPv6 服务器,getInputStream()发送请求时返回 null。

我没有找到任何有用的信息:Android开发者指南说HttpURLConnection可以透明支持IPv6,但没有提到HttpsURLConnection是否支持IPv6。有没有人有这方面的经验?

更新 - 1:

在服务器端,连接失败时我发现了一个错误日志:

[error] Hostname [xxxx:xxxx:x:xx::xxx] provided via SNI and 
        hostname xxxx:xxxx:x:xx::xxx provided via HTTP are different

要连接到相同的 IPv6 Apache 服务器(版本 2.2.27),Apache HttpClient 可以正常工作,但 HttpsURLConnection 没有。所以它可能不是服务器端的问题。有人在使用 HttpsURLConnection 之前看到此错误吗?

4

1 回答 1

0

Java支持 IPv6,并且已经做了很多年。HttpsURLConnection支持Java支持的任何东西。

您可能还注意到HttpsURLConnection扩展HttpURLConnection.

于 2014-05-20T04:34:46.273 回答