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

proschigom
Posts: 32
Joined: 09 Feb 2006, 12:12

when users pull the plug

Postby proschigom » 07 Apr 2006, 18:17

Hi,

i've been having this problem with smartfox. If anyone can please shed some light on it that would be awesome.

If multiple users are on the server, and one user basically pulls the ethernet cable on their pc, what happens then?

It seems something weird happens on the server, in that all setInterval functions get cleared or stop working for some reason.

I've tried echoing something in the internal event handler function, but I've got nothing coming from there.

I set a setInterval function to check that all users are active every 10 seconds to solve this problem but for some reason when the user gets deactivated, the interval somehow stops working..

so basically, can any1 tell me what happens or how to figure out when a user just pulls the plug out of their pc without disconnecting properly?
User avatar
goodguy20k
Posts: 71
Joined: 10 Jan 2006, 23:58
Location: Texas, USA
Contact:

Postby goodguy20k » 07 Apr 2006, 20:24

You're creating a local app then? Nothing that goes over the internet?

Lapo was very smart with his code and everytime a user has lost a connection to my server, the user is disconnected nicely. I even get the events for a user leaving the room. (I think that's the one). Here are a few of my experiences that all ended up like that:
User closed browser.
User went to a different page.
User's computer shut off. (Ouch!)
User's internet died.

(Ok, so most of those were me, but it's so cool to refer to yourself as "User". :wink:)

Hope this helps.
proschigom
Posts: 32
Joined: 09 Feb 2006, 12:12

hei

Postby proschigom » 07 Apr 2006, 23:32

Thanks goodguy for your reply.

My app is actually working over the internet. And so it gets a little harder to detect when the user disconnects I suppose.

the handler gets called when the user:

closes their window
goes to another page


but not for when they:
simply pull out the ethernet cord from their pc.
User avatar
goodguy20k
Posts: 71
Joined: 10 Jan 2006, 23:58
Location: Texas, USA
Contact:

Postby goodguy20k » 08 Apr 2006, 01:00

What version of SmartFox are you running?
User avatar
Lapo
Site Admin
Posts: 23008
Joined: 21 Mar 2005, 09:50
Location: Italy

Postby Lapo » 08 Apr 2006, 05:23

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 :)
Lapo
--
gotoAndPlay()
...addicted to flash games
proschigom
Posts: 32
Joined: 09 Feb 2006, 12:12

Postby proschigom » 08 Apr 2006, 07:01

figured it was something similar.

Lapo did you code all of smartfox urself?

So why would an interval function stop working only at the exact time that the client pulls the plug? Because I have a set interval function that runs every 10 seconds and tries oto garbage collect, but it gets killed by the disconnect for some weird reason, even if NOTHING else is happening on the server.

But at any rate,I'll definitely use the max idle time setting
proschigom
Posts: 32
Joined: 09 Feb 2006, 12:12

also...

Postby proschigom » 08 Apr 2006, 07:16

Any idea what domain to put in here?:

<AllowedAddress>*.*.*.*</AllowedAddress>

would that be the domain of the web server from which the client is to be downloaded? If so, how does smartfox know that?

Any why won't it let the web server serving the client file to be different from the smartfox server? this only happens on the LAN. It actually lets anyone connect from outside the lan!

This might mean I have to specify hosts for every machine with a local ip, I think? But either way, allowed address of * should allow any1 to connect right? by the way I put the crossdomain.xml file in the root folder of the web server also, still doesn't make a difference.

Be so happy to solver this issue once and for all.
User avatar
Lapo
Site Admin
Posts: 23008
Joined: 21 Mar 2005, 09:50
Location: Italy

Postby Lapo » 08 Apr 2006, 11:07

The <AllowedAddress> you mentioned in the message is related to the admin tool.
You can specify any number of IP addresses that are allowed to connected with the admin tool to the server.
If you pass a list of IPs, only those addresses only will be accepted as admins (provided that they know the logina and password).

In other words you have 3 levels of security for the admin too:

1 - username and password must be known
2 - password is encrypted, so sniffing will fail
3 - you can give access only to trusted IP addresses

hope it helps

:)
Lapo

--

gotoAndPlay()

...addicted to flash games
proschigom
Posts: 32
Joined: 09 Feb 2006, 12:12

hey

Postby proschigom » 10 Apr 2006, 16:48

hey

Can anyone tell me why the following directive wouldn't work in smartfox?
<AutoSendPolicyFile>true</AutoSendPolicyFile>
<PolicyAllowedDomains>
<AllowedDomain>mydomain.com</AllowedDomain>
<AllowedDomain>xxx.xxx.xxx.xxx</AllowedDomain>

</PolicyAllowedDomains>


I even load ti explicitly in the flash file. Is there asomething I'm doing wrong? The doc says smarfox should let you connect to the domain(s) that are entered as shown above. Any idea why my client still can't connect to the server?
User avatar
Lapo
Site Admin
Posts: 23008
Joined: 21 Mar 2005, 09:50
Location: Italy

Postby Lapo » 10 Apr 2006, 17:00

The doc says smarfox should let you connect to the domain(s) that are entered as shown above.


It's not smartfox that will let you connect to a certain domain, it's the flash player :) The flashplayer sandbox, by default, does not allow connection outside the current domain.

I've tested your IP address with a simple telnet connection and I see the server responding, so it seems well configured.

Maybe the client you're trying is behind a firewall.
If your test client is available on the web send us the url (privately if you prefer) and we'll check it from here.

:)
Lapo

--

gotoAndPlay()

...addicted to flash games
proschigom
Posts: 32
Joined: 09 Feb 2006, 12:12

Postby proschigom » 10 Apr 2006, 19:25

Yup, I know. problem is, it won't work! I've done all the right things.

Here's the client:

http://ppoker.xuqa.com/smartfox

I've entered the following into config.xml of s smartfox server, which is also running on this same machine.


<PolicyAllowedDomains>
<AllowedDomain>ppoker.xuqa.com</AllowedDomain>
<AllowedDomain>207.150.187.153</AllowedDomain>
</PolicyAllowedDomains>
the ip is the ip of the host. It STILL doesnt work. It does work for a parallel setup I have at poker.xuqa.com. The same exact setup. Only difference is there's no PolicyAllowedDomains entry in the config file.
Here's the parallel setup:

poker.xuqa.com/smartfox

username: demoUser@xuqa.com
password: password

Thanks for your help
User avatar
Lapo
Site Admin
Posts: 23008
Joined: 21 Mar 2005, 09:50
Location: Italy

Postby Lapo » 11 Apr 2006, 06:02

Hi,
I've done a quick local test.
I can establish a connection and send the login data but the server never responds.

Are you sure you don't have the customLogin="true" activated in your Zone?
That could explain why the login does not respond

Let me know
Lapo

--

gotoAndPlay()

...addicted to flash games
proschigom
Posts: 32
Joined: 09 Feb 2006, 12:12

oh no

Postby proschigom » 12 Apr 2006, 00:18

custom login is set to it's default, which is false.

Any idea what else it might be?
User avatar
Lapo
Site Admin
Posts: 23008
Joined: 21 Mar 2005, 09:50
Location: Italy

Postby Lapo » 12 Apr 2006, 05:10

I think you have a problem in your code, maybe contact us with an instant messenger or via email and we'll check it.
Lapo

--

gotoAndPlay()

...addicted to flash games
proschigom
Posts: 32
Joined: 09 Feb 2006, 12:12

Postby proschigom » 12 Apr 2006, 09:33

but why would the same piece of code work on the parallel server, consistently?

Return to “SmartFoxServer 1.x Discussions and Help”

Who is online

Users browsing this forum: No registered users and 24 guests