connectWithConfig() not working as expected.

Post here your questions about the Flash / Flex / Air API for SFS2X

Moderators: Lapo, Bax

Post Reply
Pippoflash
Posts: 135
Joined: 30 Jan 2006, 17:16
Contact:

connectWithConfig() not working as expected.

Post by Pippoflash »

Hi,
If I load a config file, then connect, everything works as expected:
<SmartFoxConfig>
<ip>127.0.0.1</ip>
<port>9933</port>
<zone>bunco1</zone>
<debug>false</debug>
</SmartFoxConfig>
Load this config, then call _sf.connect();
It connects as expected and triggers the callback.

While if I prepare a ConfigData object with the same exact parameters, then call connectWithConfig(), nothing happens, no callback is received:

var configObj :ConfigData = new ConfigData();
configObj.port = "127.0.0.1";
configObj.port = 9933;
configObj.zone = "bunco1";
configObj.debug = false;
_sf.connectWithConfig (configObj);

Am I missing something?
Thank you

PS
Using AS3 API 1.7.5
-----------------------
www.pippoflash.com
-----------------------
User avatar
Lapo
Site Admin
Posts: 23438
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: connectWithConfig() not working as expected.

Post by Lapo »

var configObj :ConfigData = new ConfigData();
configObj.port = "127.0.0.1";
configObj.port = 9933;
You're assigning the port value twice and never assign the host value... that might be a problem.
Lapo
--
gotoAndPlay()
...addicted to flash games
Pippoflash
Posts: 135
Joined: 30 Jan 2006, 17:16
Contact:

Re: connectWithConfig() not working as expected.

Post by Pippoflash »

That was a typo when pasting on forum, in code it's correct.

var configObj :ConfigData = new ConfigData();
configObj.host = "127.0.0.1";
configObj.port = 9933;
configObj.zone = "bunco1";
configObj.debug = false;
_sf.connectWithConfig (configObj);

Nothing happens. While using the exact same parameters loading an XML config it triggers events.
-----------------------
www.pippoflash.com
-----------------------
User avatar
Lapo
Site Admin
Posts: 23438
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: connectWithConfig() not working as expected.

Post by Lapo »

If "nothing happens" I'd recommend testing your app inside Flash/Flash Builder and see exactly what is going on. Likely an exception.
Nothing happening is not expected :)
Lapo
--
gotoAndPlay()
...addicted to flash games
Pippoflash
Posts: 135
Joined: 30 Jan 2006, 17:16
Contact:

Re: connectWithConfig() not working as expected.

Post by Pippoflash »

I am testing my app in Flash CC ide and/or with Scout running. It puzzles me too, no callback, no exception, app sits waiting for a callback forever until a client custom timeout is triggered.
Same exact flow, using external config file, connection event is triggered and app continues.
-----------------------
www.pippoflash.com
-----------------------
User avatar
Lapo
Site Admin
Posts: 23438
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: connectWithConfig() not working as expected.

Post by Lapo »

Turn on the debug in the ConfigData object and see if you get output in the logs...
Lapo
--
gotoAndPlay()
...addicted to flash games
Pippoflash
Posts: 135
Joined: 30 Jan 2006, 17:16
Contact:

Re: connectWithConfig() not working as expected.

Post by Pippoflash »

Thanks I'll try that.
-----------------------
www.pippoflash.com
-----------------------
Pippoflash
Posts: 135
Joined: 30 Jan 2006, 17:16
Contact:

Re: connectWithConfig() not working as expected.

Post by Pippoflash »

I tried with debug true, same behaviour, here are the results:

10 apr 2017 | 19:40:12,146 | INFO | SocketReader | bitswarm.sessions.DefaultSessionManager | | Session created: { Id: 1, Type: DEFAULT, Logged: No, IP: 127.0.0.1:50162 } on Server port: 9933 <---> 50162
10 apr 2017 | 19:40:34,910 | INFO | SocketReader | bitswarm.sessions.DefaultSessionManager | | Session removed: { Id: 1, Type: DEFAULT, Logged: No, IP: 127.0.0.1:50162 }

With debug on, these are the last 2 entries in log.
First one is when I connect, second one, 20 seconds later, when I close the client. The onConnection event still not triggered.

This is the code:

Code: Select all

				_sf.addEventListener			(SFSEvent.CONNECTION, onConnection);
				_sf.addEventListener			(SFSEvent.CONNECTION_LOST, onConnectionLost);
				var configObj				:ConfigData = new ConfigData();
				configObj.host				= "127.0.0.1";
				configObj.port				= 9933;
				configObj.zone				= "bunco1";
				configObj.debug				= true;
				_sf.connectWithConfig			(configObj);

Again, same exact settings with external sfsconfig.xml trigger the onConnection event.

Same settings with external, onConnection event is triggered, app can login and so on...
10 apr 2017 | 19:52:58,364 | INFO | SocketReader | bitswarm.sessions.DefaultSessionManager | | Session created: { Id: 21, Type: DEFAULT, Logged: No, IP: 127.0.0.1:50229 } on Server port: 9933 <---> 50229
10 apr 2017 | 19:52:58,474 | INFO | SFSWorker:Ext:1 | Extensions | | {bunco}: LoginHandler: loginType = fbaL
etc. etc.
-----------------------
www.pippoflash.com
-----------------------
User avatar
Lapo
Site Admin
Posts: 23438
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: connectWithConfig() not working as expected.

Post by Lapo »

Can you send us a proof of concept that reproduces the issue? You can zip it and send it to our support@... email box with a reference to this discussion.

Thanks
Lapo
--
gotoAndPlay()
...addicted to flash games
Pippoflash
Posts: 135
Joined: 30 Jan 2006, 17:16
Contact:

Re: connectWithConfig() not working as expected.

Post by Pippoflash »

Hi Lapo,
This problem also happens exactly the same in this situation:
1 - load external sfsconfig.xml
2 - connect (with server switched off)
3 - connection error event is triggered
4 - launch server
5 - connect again
It stalls exactly like in previous situation.
I have tried also re-loading config file, but it stalls anyway.

It's not easy to send you the whole server/client flow, game is already at an advanced state.
Did this ever happened in the past?

cheers
Pippo
-----------------------
www.pippoflash.com
-----------------------
User avatar
Lapo
Site Admin
Posts: 23438
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: connectWithConfig() not working as expected.

Post by Lapo »

I asked for an example because we cannot reproduce the first issue you have reported in any way shape or form.
Here's another idea.
Take any example from our "Flash Example pack" such as the SimpleChat. Can you reproduce the 1st problem you have posted there?
This problem also happens exactly the same in this situation:
1 - load external sfsconfig.xml
2 - connect (with server switched off)
3 - connection error event is triggered
4 - launch server
5 - connect again
It stalls exactly like in previous situation.
I have tried also re-loading config file, but it stalls anyway.
If the connection fails, you will need to re-do everything from scratch, which means:
1) recreate the SmartFox object
2) reload the XML
Lapo
--
gotoAndPlay()
...addicted to flash games
Pippoflash
Posts: 135
Joined: 30 Jan 2006, 17:16
Contact:

Re: connectWithConfig() not working as expected.

Post by Pippoflash »

Thx I will try that.
Is there any GC friendly advice to dispose previous Smartfox object?
-----------------------
www.pippoflash.com
-----------------------
User avatar
Lapo
Site Admin
Posts: 23438
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: connectWithConfig() not working as expected.

Post by Lapo »

We have never encountered any issues with GC in Flash.
Lapo
--
gotoAndPlay()
...addicted to flash games
Pippoflash
Posts: 135
Joined: 30 Jan 2006, 17:16
Contact:

Re: connectWithConfig() not working as expected.

Post by Pippoflash »

:D
-----------------------
www.pippoflash.com
-----------------------
Post Reply