Failed to create a selector

Post here your questions about the Java client / Android API for SFS2X

Moderators: Lapo, Bax

User avatar
exception
Posts: 5
Joined: 13 Sep 2015, 03:45

Failed to create a selector

Postby exception » 30 Jun 2016, 09:23

I'm trying to use libgdx (so I use java API for iOS) with smartfoxserver. I got android and desktop running fine ( able to connect to and login to a localhost smartfoxserver), but been having this problem on iOS

On the client I'm seeing this error:

sfs2x.client.core.sockets.TCPSocketLayer - TCPSocketLayer: Socket error: Failed to create a selector. And no connection event was received.

On the server I see a session created but removed immediately after.

16:02:19,298 INFO [SocketReader] sessions.DefaultSessionManager - Session created: { Id: 3, Type: DEFAULT, Logged: No, IP: 127.0.0.1:49365 } on Server port: 9933 <---> 49365
16:02:19,299 INFO [SocketReader] sessions.DefaultSessionManager - Session removed: { Id: 3, Type: DEFAULT, Logged: No, IP: 127.0.0.1:49365 }

What could be the problem? I suppose I use address 127.0.0.1 for iPhone simulator (unlike Android emulator uses 10.0.2.2).
User avatar
Lapo
Site Admin
Posts: 22999
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: Failed to create a selector

Postby Lapo » 30 Jun 2016, 10:05

Normally a connection error should cause this error message:
TCPSocketLayer: Socket error: Connection refused


But since you're running in an iOS Simulator I dare say anything is possible :) Honestly I am not familiar with libgdx, I suppose it cross compiles the Java bytecode to ARM native code. Is there any limitation on the Java classes that can be used in your project? Does it support the whole JDK?

As regards the address, yes in the iOS simulator you can use 127.0.0.1 to connect to your machine. My suggestion is to create a simple connector test application in pure Java and connect to the localhost and see if it works. If it doesn't there's some network issue, such as a firewall blocking the connection.

Otherwise it's likely to be an issue with libgdx's cross compilation.

cheers
Lapo
--
gotoAndPlay()
...addicted to flash games
User avatar
exception
Posts: 5
Joined: 13 Sep 2015, 03:45

Re: Failed to create a selector

Postby exception » 01 Jul 2016, 03:03

Thanks for the reply. I'm pretty sure it is not a firewall or server issue. I'm able to connect to the server with an Unity client, also able to connect with libgdx in android and desktop mode. Just somehow it does work in iOS!!! I guess I'll try asking the libgdx community then...

Any one here uses libgdx with smartfoxserver and be able to make iOS (moe) work?!
User avatar
exception
Posts: 5
Joined: 13 Sep 2015, 03:45

Re: Failed to create a selector

Postby exception » 22 Sep 2016, 13:12

OK, somehow I found it was because an unsupported feature in the Multi-OS Engine https://multi-os-engine.org. And it was supposed to be fixed.

I'm now testing their OSS version and I got the following error. I'm not sure how to go about debugging it and see where the problem is

[New I/O client worker #1-1] WARN sfs2x.client.controllers.SystemController - Cannot instantiate handler for eventId: 0, ResHandshake, Class: sfs2x.client.controllers.system..ResHandshake
User avatar
Lapo
Site Admin
Posts: 22999
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: Failed to create a selector

Postby Lapo » 22 Sep 2016, 13:42

Hi,
You should never see such an error.
It is basically saying that some of the necessary classes in the API are missing. Unless your current copy of the API is corrupt I have no other idea.

That, or the platform you're working with is messing up the SFS2X API.

To download a fresh copy of the API go here:
http://smartfoxserver.com/download/sfs2x#p=client

thanks
Lapo

--

gotoAndPlay()

...addicted to flash games

Return to “SFS2X Java / Android API”

Who is online

Users browsing this forum: No registered users and 7 guests