when users pull the plug

Need help with SmartFoxServer? You didn't find an answer in our documentation? Please, post your questions here!

Moderators: Lapo, Bax

User avatar
Lapo
Site Admin
Posts: 23438
Joined: 21 Mar 2005, 09:50
Location: Italy

Post by Lapo »

are the 2 parallel servers physically on the same machine?
are they the same version?
do they use the same zone configuration?
Lapo
--
gotoAndPlay()
...addicted to flash games
CanOncel
Posts: 12
Joined: 20 Jul 2016, 11:18

Re:

Post by CanOncel »

Lapo wrote:That's what we call "sloppy disconnections" :) And they can happen more often than you can imagine.

The example you provided is just one of those cases. If you want to do a better experiment try this:

- start the server on one machine
- launch a client on another machine and establish a connection
- now check the connections on the server using netstat (under Windows open a console window and type "netstat"). You will notice the client-server connection in ESTABLISHED status
- now pull the ethernet cable off the client machine
- go back to the server and keep checking the netstat... you'll be amazed in seeing that the connection is still there!! :shock:

That's why SmartFoxServer doesn't handle the disconnection, because the lower level TCP layer didn't catch it too :)

Anyways SFS deals with the problem efficiently by automatically closing all idle connections as specified in the <MaxUserIdleTime> parameter in the config.xml

So, even if you have thousands of those garbage connections, SFS will shut them down automagically

Hope it helps :)
Hello Lapo,

Is there any way to handle disconnection for Unity or AS3?
User avatar
Lapo
Site Admin
Posts: 23438
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: Re:

Post by Lapo »

CanOncel wrote: Is there any way to handle disconnection for Unity or AS3?
Hi,
your question is too vague, sorry. What does it mean "handling disconnections"?
In which way you want to handle a disconnection?

There's a client side event for that. Unless you're asking for how to reconnect after a connection loss. In which cases I'd recommend reading this: http://docs2x.smartfoxserver.com/Gettin ... n-hrc-plus

cheers
Lapo
--
gotoAndPlay()
...addicted to flash games
CanOncel
Posts: 12
Joined: 20 Jul 2016, 11:18

Re: Re:

Post by CanOncel »

Lapo wrote:
CanOncel wrote: Is there any way to handle disconnection for Unity or AS3?
Hi,
your question is too vague, sorry. What does it mean "handling disconnections"?
In which way you want to handle a disconnection?

There's a client side event for that. Unless you're asking for how to reconnect after a connection loss. In which cases I'd recommend reading this: http://docs2x.smartfoxserver.com/Gettin ... n-hrc-plus

cheers
Hello Lapo,

I tested my program by turning Wi-Fi on/off. I recognize that isConnected() function is still true, when Wi-Fi is turned off. Is there a way of check connection?

On the other hand, I also defined SFSEvent.CONNECTION_LOST, but when Wi-Fi is turned off, the callback is not called.
User avatar
Lapo
Site Admin
Posts: 23438
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: when users pull the plug

Post by Lapo »

Turning off the Wifi does not close your connections. This has nothing to do with SmartFox, it's how TCP works.

We ha discussed this many times:
http://forums.smartfoxserver.com/viewto ... 24&p=79511
http://forums.smartfoxserver.com/viewto ... 43&p=81832

For more see also:
http://docs2x.smartfoxserver.com/Gettin ... n-hrc-plus

cheers
Lapo
--
gotoAndPlay()
...addicted to flash games
Post Reply