Android 2.2 SDK is not work with Java Client API

Post here all your questions related with SmartFoxServer Java API

Moderators: Lapo, Bax

keyfl
Posts: 1
Joined: 02 Jun 2010, 03:30

Android 2.2 SDK is not work with Java Client API

Postby keyfl » 02 Jun 2010, 03:39

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
User avatar
Lapo
Site Admin
Posts: 22999
Joined: 21 Mar 2005, 09:50
Location: Italy

Postby Lapo » 08 Jun 2010, 13:09

Quite strange error. We're going to investigate soon.
Stay tuned.
Lapo
--
gotoAndPlay()
...addicted to flash games
stager
Posts: 12
Joined: 06 May 2009, 11:28

Postby stager » 10 Jun 2010, 08:29

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.
User avatar
Lapo
Site Admin
Posts: 22999
Joined: 21 Mar 2005, 09:50
Location: Italy

Postby Lapo » 10 Jun 2010, 19:00

Thanks!
Lapo

--

gotoAndPlay()

...addicted to flash games
stager
Posts: 12
Joined: 06 May 2009, 11:28

Postby stager » 01 Jul 2010, 08:37

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.
User avatar
Lapo
Site Admin
Posts: 22999
Joined: 21 Mar 2005, 09:50
Location: Italy

Postby Lapo » 15 Jul 2010, 10:41

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

--

gotoAndPlay()

...addicted to flash games
stager
Posts: 12
Joined: 06 May 2009, 11:28

Postby stager » 23 Jul 2010, 18:33

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...
cBroadbo
Posts: 20
Joined: 16 Apr 2009, 17:49

Postby cBroadbo » 09 Aug 2010, 16:47

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
User avatar
Lapo
Site Admin
Posts: 22999
Joined: 21 Mar 2005, 09:50
Location: Italy

Postby Lapo » 10 Aug 2010, 08:35

i am going to verify it and post my findings here soon.
Thanks for reporting.
Lapo

--

gotoAndPlay()

...addicted to flash games
User avatar
Lapo
Site Admin
Posts: 22999
Joined: 21 Mar 2005, 09:50
Location: Italy

Postby Lapo » 10 Aug 2010, 09:32

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

--

gotoAndPlay()

...addicted to flash games
cBroadbo
Posts: 20
Joined: 16 Apr 2009, 17:49

Postby cBroadbo » 10 Aug 2010, 15:42

You're welcome. But let's give the credit to gustyJin on stackoverflow for finding the solution.

Craig

Return to “Java2SE / Android Client API”

Who is online

Users browsing this forum: No registered users and 5 guests