Page 1 of 1

Android 2.2 SDK is not work with Java Client API

Posted: 02 Jun 2010, 03:39
by keyfl
Hello,

I found there is a socket error when connecting to sfs server.

Error Message:
java.net.SocketException: Bad address family

It works fine in Android 2.1 or below SDK, but not in 2.2

I guess the new SDK using default IPv6 address rather than IPv4 address

Could it be fix in the xmlSocket.jar?

Thx

Posted: 08 Jun 2010, 13:09
by Lapo
Quite strange error. We're going to investigate soon.
Stay tuned.

Posted: 10 Jun 2010, 08:29
by stager
Hello,

Lapo wrote:Quite strange error. We're going to investigate soon.
Stay tuned.


We have the same problem and in our case it is immediately followed by NullPointerException. Similar problem had been described here: http://stackoverflow.com/questions/2879 ... et-connect

Link above contains stack trace, so it can be useful to find the problem.

Best regards,
Serge.

Posted: 10 Jun 2010, 19:00
by Lapo
Thanks!

Posted: 01 Jul 2010, 08:37
by stager
Hi!

Any news on this issue? Since Nexus One phones already started to receive updates to 2.2 this issue become a serious problem...

Best regards,
Serge.

Posted: 15 Jul 2010, 10:41
by Lapo
Quick update.
The problem is very low level and at the moment we haven't found any detailed explanation of why a MINA client fails to even establish a connection. It's not MINA's fault, evidently something in the guts of the Android socket implementation was changed, breaking the MINA connector.

We'll investigate and see what we can do. Probably an alternative XMLSocket library based on java.net.Socket is a good workaround for now.
From what I read in your StackOverflow post you already have done that. Can we see the code?
You can PM me, if you wish.

Posted: 23 Jul 2010, 18:33
by stager
Hello,

Lapo wrote:Quick update.
The problem is very low level and at the moment we haven't found any detailed explanation of why a MINA client fails to even establish a connection. It's not MINA's fault, evidently something in the guts of the Android socket implementation was changed, breaking the MINA connector.

We'll investigate and see what we can do. Probably an alternative XMLSocket library based on java.net.Socket is a good workaround for now.
From what I read in your StackOverflow post you already have done that. Can we see the code?
You can PM me, if you wish.


It's not my post on StackOverflow - I found it while trying to investigate this problem, because the problem described there and our problem are the same... So we still have no solution... On emulator problem can be reproduced easily...

Posted: 09 Aug 2010, 16:47
by cBroadbo
That link to the post on stackoverflow contains a solution which is to add this line

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


to your code. Has anyone who has the problem tried this? Did it work?

Thanks,
Craig

Posted: 10 Aug 2010, 08:35
by Lapo
i am going to verify it and post my findings here soon.
Thanks for reporting.

Posted: 10 Aug 2010, 09:32
by Lapo
Good new everyone! :)
The simple line of code above actually does the trick. I was able to successfully run our example without any errors.

Thanks cBroadbo for reporting.

Posted: 10 Aug 2010, 15:42
by cBroadbo
You're welcome. But let's give the credit to gustyJin on stackoverflow for finding the solution.

Craig