question about loadConfig

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

Moderators: Lapo, Bax

pantinor
Posts: 17
Joined: 19 Jan 2012, 02:10

question about loadConfig

Postby pantinor » 03 Feb 2012, 03:17

Is it possible to load config using a resource URL instead of a filename? I have the app and xml in a jar file and want to use the class.getResource style of loading it.

Otherwise, can i skip loading from external XML and just set the connection props directly in API?

Thanks.
User avatar
A51Integrated
Posts: 240
Joined: 03 Jan 2012, 19:55
Location: Toronto, Canada
Contact:

Postby A51Integrated » 03 Feb 2012, 04:51

Sure can. Just read through the docs for sfs2x.client.util.ConfigData. There are setters for all parameters.

Then call SmartFox.connect() directly.
A51 Integrated
http://a51integrated.com / +1 416-703-2300
pantinor
Posts: 17
Joined: 19 Jan 2012, 02:10

Postby pantinor » 04 Feb 2012, 02:17

I am getting a null value when doing this below. Why is that? It seems like a catch 22 if you need to call loadConfig on a xml that is not there. It seems like we don't support anything except using an xml file.

ConfigData cfg = sfs.getConfig();
cfg.setHost(serverIPTextField.getText());
cfg.setUdpHost(serverIPTextField.getText());
cfg.setPort(9933);
cfg.setUdpPort(9933);
pantinor
Posts: 17
Joined: 19 Jan 2012, 02:10

Postby pantinor » 04 Feb 2012, 03:15

I was able to connect by doing this directly.

sfs.connect(serverIPTextField.getText(),9933);


Followed by sending the client loginrequest with the name and zone parameters.

I could not find any use for the ConfigData object. Even when creating a new ConfigData object explicitly.

The problem is after the connect, there is only the HANDSHAKE event from the server. There is no LOGIN of CONNECTION events fired despite registering for the callbacks on those events. The smartfox log shows a successful login.

Seems like some things are missing here.
User avatar
A51Integrated
Posts: 240
Joined: 03 Jan 2012, 19:55
Location: Toronto, Canada
Contact:

Postby A51Integrated » 06 Feb 2012, 18:01

The fact that it only connects is by design. That's all it should do. Once you receive the onConnection event, you will then have to manually login to a zone.
A51 Integrated

http://a51integrated.com / +1 416-703-2300

Return to “SFS2X Java / Android API”

Who is online

Users browsing this forum: No registered users and 8 guests