Page 1 of 1
question about loadConfig
Posted: 03 Feb 2012, 03:17
by pantinor
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.
Posted: 03 Feb 2012, 04:51
by A51Integrated
Sure can. Just read through the docs for sfs2x.client.util.ConfigData. There are setters for all parameters.
Then call SmartFox.connect() directly.
Posted: 04 Feb 2012, 02:17
by pantinor
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);
Posted: 04 Feb 2012, 03:15
by pantinor
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.
Posted: 06 Feb 2012, 18:01
by A51Integrated
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.