Android and IPv6 in Java

孤人 提交于 2019-12-05 00:40:51

Use this static method in Inet6Address to get a Inet6Address object for your address,

Inet6Address getByAddress (String host, byte[] addr, int scope_id)

then use, the following socket constructor to get a socket,

Socket(InetAddress dstAddress, int dstPort).

IP6 support is the choice of the vendor to include, to my understanding, support is there.

I am assuming you are testing you app in emulator. Looking at how android does networking, http://developer.android.com/guide/developing/devices/emulator.html#emulatornetworking It's behind an IPv4 router addressed 10.0.2.1. Hence, you are not able to open a Socket using IPv6. It's all dependent if a path exists of all the routers who are IPv6 compatible from your phone to your destination.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!