Android 2.2 and “Bad address family” on Socket Connect

左心房为你撑大大i 提交于 2019-11-30 09:20:49

this was a bug and has been fixed: http://code.google.com/p/android/issues/detail?id=9431

you should be very careful with the java.net.preferIPv6Addresses workaround, because there are devices and networks where you do want IPv6.

(and, as the original poster found, if you can use io rather than nio, you generally should.)

Thanks to Josh... I could get the andswer for this problem at the link above

using this code before opening a Selector

==> System.setProperty("java.net.preferIPv6Addresses", "false");

i can pass the problem...

Yes, You are right. I posted this problem to google groups and the comment was "the emulator doesn't support IPv6". Here is the link http://code.google.com/p/android/issues/detail?id=9431

Do you know why application should think it's device can support iPv6 or not? I think java application programmers don't need to know that.

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