User Name already taken

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

Moderators: Lapo, Bax

dvine
Posts: 47
Joined: 21 Sep 2006, 10:08
Location: Köln, Germany
Contact:

User Name already taken

Postby dvine » 07 Aug 2007, 22:26

Hey fellow smartfox-lovers,

I do have a problem that occurs very often for me.

If a user is logged on to smartfoxserver and then his internet connection is disconnected he is not disconnected from smartfoxserver. So when he tries to log in again he gets a "user name already taken" response.

How do i allow this user to log in now?

I could set the idleTimeout lower, but i dont want that to be too low, because in my games the users sometimes hae to wait a file until a game for them fires... And i dont want them to be disconnected while queued for a game...

Please help me...
Daniel
froesi
Posts: 32
Joined: 24 Jul 2007, 10:00

Postby froesi » 08 Aug 2007, 07:20

Hi dvine,

i recognized the same problem. If the internet-connection is slow and the user disconnects he will be disconnected from the room, but not from the zone.
The point is, that you can't join the same user (same nick) into a zone again.
I solved it this way. when the user logs in, he will be loged in with his nick and a random, maybe uniqueId. So you can substring the Id, you have the "real" name, but internal he'll alyways be a "unique user".
the other user, who wasn't really disconnected from the zone will be kicked, after the idle time.

cheers
froesi
dvine
Posts: 47
Joined: 21 Sep 2006, 10:08
Location: Köln, Germany
Contact:

Postby dvine » 09 Aug 2007, 11:25

Hey froesi, thanks for your quick replay, but :

can maybe someone from SFS tell me if there is a better way to do this? I do like your workaround, but it seems like there has to be a better way...
User avatar
Lapo
Site Admin
Posts: 21362
Joined: 21 Mar 2005, 09:50
Location: Italy

Postby Lapo » 09 Aug 2007, 12:37

It is necessary that you lower the idle value in the config to allow SmartFoxServer clean up ghost connections.

In order to avoid that the server disconnects users that are playing or interacting you can simply send a small "ping packet" to the server every once in a while.

Example: you can set the maxIdle time to 1-2 minutes and send the "ping" request every 50 seconds.
This way active clients will never be disconnected and ghost connections will be cleaned by the server

hope it helps

p.s. the "ping" request can be an empty (no params) JSON/Raw request
Lapo
--
gotoAndPlay()
...addicted to flash games
dvine
Posts: 47
Joined: 21 Sep 2006, 10:08
Location: Köln, Germany
Contact:

Postby dvine » 12 Aug 2007, 14:28

Hey Lapo,
thanks for your response. I tried to follow your instructions and added this to my application:

Code: Select all


myDontDropInterval = setInterval(dontDropMe, 30000);
function dontDropMe() {
   smartfox.sendXtMessage("X","X")
}



But I still get disconnected after the Idle-Timeout. What am I doing wrong?? Do I have to actually declare an Extension for this on the Server Side?
Greetings
Dan
patso
Posts: 380
Joined: 13 Nov 2006, 13:44
Location: Sofia, Bulgaria

Postby patso » 14 Aug 2007, 14:32

Title bit offtopic:

Using idle is very good habit but I need a force login. Of course there is always a way(we are talking about java - with java everything is possible :) :wink: ) but it's a good to do it using the best one according to performance and security.

I going to ask for one very simple variant - I suppose that there is some pitfall - otherwise it's too good to be true :).

So my idea is to to get the old user object(I mean to get the user object that represents the user with the old connection) and to do the follow:

Code: Select all

extensionHelper.disconnectUser(user);


Are there pitfalls in using this?
User avatar
Lapo
Site Admin
Posts: 21362
Joined: 21 Mar 2005, 09:50
Location: Italy

Postby Lapo » 15 Aug 2007, 08:55

dvine wrote:But I still get disconnected after the Idle-Timeout. What am I doing wrong?? Do I have to actually declare an Extension for this on the Server Side?
Greetings
Dan

How long is Idle Timeout?
Lapo

--

gotoAndPlay()

...addicted to flash games
dvine
Posts: 47
Joined: 21 Sep 2006, 10:08
Location: Köln, Germany
Contact:

Postby dvine » 15 Aug 2007, 09:34

2 minutes...
User avatar
Lapo
Site Admin
Posts: 21362
Joined: 21 Mar 2005, 09:50
Location: Italy

Postby Lapo » 16 Aug 2007, 09:01

we can't reproduce the problem.
we tested the same scenario:

- server maxIdleTime = 120 seconds
- client sends a ping message every 30 sec

connection goes on forever and client never gets disconnected

You either have a problem with config/code or you're using an old version of the server which had that bug.
Lapo

--

gotoAndPlay()

...addicted to flash games
mixart
Posts: 95
Joined: 08 Aug 2007, 20:32

Postby mixart » 17 Dec 2007, 22:28

I have this same issue - users being disconnected by their ISP then getting the username taken error.

The workaround being suggested makes the idletime useless.

If you send a ping every 30 seconds, then a user is never idle. I still want someone who is idle for 10 minutes to be logged out.

Any ideas?
User avatar
mistermind
Posts: 131
Joined: 15 Sep 2007, 01:33
Contact:

Postby mistermind » 18 Dec 2007, 03:07

yep my post about force login focus on the same issue. It would be very very nice if SFS had an extra parameter on the login() class that would allow us to force the connection to the server rather then work on these limited work around :)
That would solve A LOT of validated login issues.
User avatar
Lapo
Site Admin
Posts: 21362
Joined: 21 Mar 2005, 09:50
Location: Italy

Postby Lapo » 18 Dec 2007, 06:59

If you send a ping every 30 seconds, then a user is never idle. I still want someone who is idle for 10 minutes to be logged out.

NO, if the user connection stales and becomes a ghost connection the server will destroy it.
This marks the difference between an active client (pinging) and ghost one(not pinging anymore)
Lapo

--

gotoAndPlay()

...addicted to flash games
User avatar
Lapo
Site Admin
Posts: 21362
Joined: 21 Mar 2005, 09:50
Location: Italy

Postby Lapo » 18 Dec 2007, 07:06

mixart, mistermind:
What version of the server you currently running?
Lapo

--

gotoAndPlay()

...addicted to flash games
User avatar
mistermind
Posts: 131
Joined: 15 Sep 2007, 01:33
Contact:

Postby mistermind » 18 Dec 2007, 17:27

SmartFoxBasic 1.5.5, 500 users license :)
I've noticed most of the most interesting updates go to the PRO, but since there is not much use for me right now of that version I'm sticking with that one.
The other thing that worries me is possible migration problems, but besides that is just the fact that currently my game doesn't require the amazing power of the SFS PRO
User avatar
Lapo
Site Admin
Posts: 21362
Joined: 21 Mar 2005, 09:50
Location: Italy

Postby Lapo » 19 Dec 2007, 09:46

Patch 1.5.9 for BASIC is coming very soon and it will bring the same fixes done to the PRO. Most of the fixes address ghost/sloppy disconnections.
Lapo

--

gotoAndPlay()

...addicted to flash games

Return to “SmartFoxServer 1.x Discussions and Help”

Who is online

Users browsing this forum: No registered users and 18 guests