Page 1 of 1

Failed to create a selector

Posted: 30 Jun 2016, 09:23
by exception
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).

Re: Failed to create a selector

Posted: 30 Jun 2016, 10:05
by Lapo
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

Re: Failed to create a selector

Posted: 01 Jul 2016, 03:03
by exception
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?!

Re: Failed to create a selector

Posted: 22 Sep 2016, 13:12
by exception
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

Re: Failed to create a selector

Posted: 22 Sep 2016, 13:42
by Lapo
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