i try to run my cocos2dx game with api 0.9.5 on android, which work fine on iOS and win7, but it crash on android.
and i found, in ConfigLoader::LoadConfig, using ifstream to open read file.
my sfs-config.xml is in the assets, which pack into apk with other resource, and ifstream can not read the file in apk.
use cocos2dx CCFileUtils getFileData instead, the game works.
ConfigLoader::LoadConfig can not read the file in apk
Moderators: Lapo, Bax, MBagnati
Re: ConfigLoader::LoadConfig can not read the file in apk
You can avoid loading an external file from the APK package and connect directly by passing the IP address and port of the server.
Thanks
Thanks
Re: ConfigLoader::LoadConfig can not read the file in apk
If I connect to the server by the following code without loading config xml file, will bluebox be started in the client side?
smartfox.Connect("server ip", 9933);
At the same time, should i set the httpPort?
If i should set it, how can I set in the code? Thanks.
smartfox.Connect("server ip", 9933);
At the same time, should i set the httpPort?
If i should set it, how can I set in the code? Thanks.
Re: ConfigLoader::LoadConfig can not read the file in apk
You can configure the connection parameter using the ConfigData class.
It contains the same settings that the external XML file uses, but this way you can do everything in code. Then you can call connect passing the ConfigData instance.
Yes by default the BlueBox connection is active.
By default port 8080 is used. If you're running the SmartFox's http server on a different port you will need to specify it in the client config, otherwise the default will be used.
Cheers
It contains the same settings that the external XML file uses, but this way you can do everything in code. Then you can call connect passing the ConfigData instance.
If I connect to the server by the following code without loading config xml file, will bluebox be started in the client side?
smartfox.Connect("server ip", 9933);
Yes by default the BlueBox connection is active.
At the same time, should i set the httpPort?
By default port 8080 is used. If you're running the SmartFox's http server on a different port you will need to specify it in the client config, otherwise the default will be used.
Cheers
Re: ConfigLoader::LoadConfig can not read the file in apk
Thanks for the reply.
We are using SmartFox 2X Client API C# 1.5.6. There is no ConfigData class. It also don't have connectWithConfig(cfg:ConfigData):void method.
Luckily we are using the default 8080 http port.
We are using SmartFox 2X Client API C# 1.5.6. There is no ConfigData class. It also don't have connectWithConfig(cfg:ConfigData):void method.
Luckily we are using the default 8080 http port.
Re: ConfigLoader::LoadConfig can not read the file in apk
Then this is the wrong section This is C++ not C#
Anyways: in the C# API version 1.5.6 there certainly is a class Sfs2X.Util.ConfigData, and a method SmartFox.Connect(ConfigData cf)
Please make sure your using ... declaration at the top of your code are correct.
Thanks
Anyways: in the C# API version 1.5.6 there certainly is a class Sfs2X.Util.ConfigData, and a method SmartFox.Connect(ConfigData cf)
Please make sure your using ... declaration at the top of your code are correct.
Thanks
Re: ConfigLoader::LoadConfig can not read the file in apk
great, I have found that (smartFox.Connect(config)) in C#. Thanks
Who is online
Users browsing this forum: No registered users and 34 guests