Android 2.2 and “Bad address family” on Socket Connect

后端 未结 3 1061
刺人心
刺人心 2021-01-02 12:27

I have a fairly simple game that works perfectly on every version now up through 2.1, but with the new 2.2 (Froyo) release I am unable to create a socket. I am using the mi

相关标签:
3条回答
  • 2021-01-02 12:40

    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.

    0 讨论(0)
  • 2021-01-02 12:42

    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.)

    0 讨论(0)
  • 2021-01-02 12:42

    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...

    0 讨论(0)
提交回复
热议问题