smartfoxserver.com Forum Index
Author Message
<  Java2SE / Android Client API  ~  Android 2.2 SDK is not work with Java Client API
Post new topic   Reply to topic

keyfl
PostPosted: Wed Jun 02, 2010 3:39 am  Reply with quote



Joined: 02 Jun 2010
Posts: 1

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
Back to top
View user's profile Send private message
Lapo
PostPosted: Tue Jun 08, 2010 1:09 pm  Reply with quote
Site Admin


Joined: 21 Mar 2005
Posts: 9308
Location: Italy

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

_________________
Lapo
--
gotoAndPlay()
...addicted to flash games
Back to top
View user's profile Send private message
stager
PostPosted: Thu Jun 10, 2010 8:29 am  Reply with quote



Joined: 06 May 2009
Posts: 10

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/2879455/android-2-2-and-bad-address-family-on-socket-connect

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

Best regards,
Serge.
Back to top
View user's profile Send private message
Lapo
PostPosted: Thu Jun 10, 2010 7:00 pm  Reply with quote
Site Admin


Joined: 21 Mar 2005
Posts: 9308
Location: Italy

Thanks!

_________________
Lapo
--
gotoAndPlay()
...addicted to flash games
Back to top
View user's profile Send private message
stager
PostPosted: Thu Jul 01, 2010 8:37 am  Reply with quote



Joined: 06 May 2009
Posts: 10

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.
Back to top
View user's profile Send private message
Lapo
PostPosted: Thu Jul 15, 2010 10:41 am  Reply with quote
Site Admin


Joined: 21 Mar 2005
Posts: 9308
Location: Italy

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
Back to top
View user's profile Send private message
stager
PostPosted: Fri Jul 23, 2010 6:33 pm  Reply with quote



Joined: 06 May 2009
Posts: 10

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...
Back to top
View user's profile Send private message
cBroadbo
PostPosted: Mon Aug 09, 2010 4:47 pm  Reply with quote



Joined: 16 Apr 2009
Posts: 18

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
Back to top
View user's profile Send private message
Lapo
PostPosted: Tue Aug 10, 2010 8:35 am  Reply with quote
Site Admin


Joined: 21 Mar 2005
Posts: 9308
Location: Italy

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

_________________
Lapo
--
gotoAndPlay()
...addicted to flash games
Back to top
View user's profile Send private message
Lapo
PostPosted: Tue Aug 10, 2010 9:32 am  Reply with quote
Site Admin


Joined: 21 Mar 2005
Posts: 9308
Location: Italy

Good new everyone! Smile
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
Back to top
View user's profile Send private message
cBroadbo
PostPosted: Tue Aug 10, 2010 3:42 pm  Reply with quote



Joined: 16 Apr 2009
Posts: 18

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

Craig
Back to top
View user's profile Send private message
Display posts from previous:   
All times are GMT

View next topic
View previous topic
Page 1 of 1
smartfoxserver.com Forum Index  ~  Java2SE / Android Client API

Post new topic   Reply to topic


 
Jump to:  

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum




Powered by phpBB