Serverside errorcodes

Post here your questions about Actionscript and Java server side extensions development.

Moderators: Lapo, Bax

Post Reply
potmo
Posts: 154
Joined: 02 Feb 2007, 14:28
Location: Stockholm Sweden
Contact:

Serverside errorcodes

Post by potmo »

Id like to add my own errorcodes and override the errormessages return by i.e. _server.

I Know that its not possible to just edit a xml-file to change the errormessages so ill have to do like this

var errorcode = 0
var obj = _server.loginUser(nick, pass, chan)

if (obj.error == "This user name is already taken")
{
errorcode = 135
}

// return logKO and errorcode

The problem is i dont really know all errors and i dont want to do everything that might produce an error so is there any reference of the errormessages?
Nisse Bergman
Raketspel
User avatar
Lapo
Site Admin
Posts: 23438
Joined: 21 Mar 2005, 09:50
Location: Italy

Post by Lapo »

Yep, the error message system is pretty limited at the moment without error codes. It's our intention to add a code-based error system to allow localization etc...

At the moment we don't have such list ready, but I can prepare one in a couple of days and publish it here.

Hope it helps
Lapo
--
gotoAndPlay()
...addicted to flash games
potmo
Posts: 154
Joined: 02 Feb 2007, 14:28
Location: Stockholm Sweden
Contact:

Post by potmo »

thats really great.
I dont want to send a lot of information to the hackers.
If they want to hack me. They will have to work for it :)
Nisse Bergman
Raketspel
User avatar
Lapo
Site Admin
Posts: 23438
Joined: 21 Mar 2005, 09:50
Location: Italy

Post by Lapo »

Here we go:

Login errors:
Sorry, this zone is full!
You should provide a non empty user name!
Socket connection is null
Socket connection is closed
User already logged in
Zone does not exist!
This user name is already taken.
Your username contains badwords!
Too many connections coming from your ip address.

Join errors:
Room does not exist or was just deleted (id=*roomId)
This room is currently full
All player slots are occupied
All spectator slots are occupied

Room creation errors:
Bad or empty room name.
Room name already taken.
Too many rooms.
You have reached the max. amount of rooms that you can create at once.

Buddy List errors:
Unable to load the Buddy List!
Your buddy list is full!

Hope to have listed them all :)

* = roomId of the missing room
Lapo
--
gotoAndPlay()
...addicted to flash games
potmo
Posts: 154
Joined: 02 Feb 2007, 14:28
Location: Stockholm Sweden
Contact:

Post by potmo »

thanks a lot! This will make my day brighter :)
Nisse Bergman
Raketspel
potmo
Posts: 154
Joined: 02 Feb 2007, 14:28
Location: Stockholm Sweden
Contact:

Post by potmo »

for those who wants to know. it seems as all strings have a space in the beginning

"This user name is already taken." is really " This user name is already taken."
Nisse Bergman
Raketspel
User avatar
Lapo
Site Admin
Posts: 23438
Joined: 21 Mar 2005, 09:50
Location: Italy

Post by Lapo »

Really? I've double checked and no, there's no initial white space.
Sounds odd
Lapo
--
gotoAndPlay()
...addicted to flash games
Ganius
Posts: 92
Joined: 13 Feb 2007, 12:49

Post by Ganius »

Sorry to revive an old post, but is there somewhere where not only these messages are listed, but also explains the cause of these errors? I have a number of "Socket connection is closed" errors every day, but I'm not sure what would be causing them...

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

Post by Lapo »

Hi,
there isn't an official list of errors, as most of them are self explanatory.
Could you provide a copy/paste of the error you are referring to?
Lapo
--
gotoAndPlay()
...addicted to flash games
Ganius
Posts: 92
Joined: 13 Feb 2007, 12:49

Post by Ganius »

Code: Select all

var obj = _server.loginUser(nick, pass, chan, true);
var error = "";
if (obj.success == false)
{
     error = obj.error;
     if (error != null)
     {
          error = error.trim();
     }
}
	
if (error == "")
{
     // normal login procedures
     response._cmd = "logIN";

     .....
}
else
{
     // login error
     response._cmd = "logBAD";
     trace("Login failed for "+nick+": "+error);

     .....

}
Sometimes in the login error, we get 'Login failed for XXXXXX: Socket connection is closed'.

So I'm assuming that this just means that between the time the user connected to the server and sent a login request, the socket was closed somehwere along the way. It's just that we get quite a few per day.

I DO detect some hacked clients, and log them in, get some details, then log them out again, but this is in a completely separate process before we even get to this section - if they are using a hacked client, I don't even try to log them in here. They only reach this code if everything is ok. So it's not a matter of me disconnecting them myself beforehand.

It's not a massive problem (I don't think), but I'm curious as to why it happens so often...

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

Post by Lapo »

So I'm assuming that this just means that between the time the user connected to the server and sent a login request, the socket was closed somehwere along the way. It's just that we get quite a few per day.
Exactly correct.
It's not a massive problem (I don't think), but I'm curious as to why it happens so often...
If you have a high traffic and use a database for checking credentials you might need to adjust the threading settings in order to avoid that login requests lag.
Database calls are slower than normal code execution so you need to add few more threads if you see the server queues become busy.

How does this connects to the problem you have mentioned?
If the server queue are very busy and there's not enough worker threads the login process will slow down and people will have to wait in line. If the wait is too long the socket will disconnect.
Maybe you could adjust the <MaxSocketIdleTime> as well if it's too short.

This topic is discussed in greater details here:
http://www.smartfoxserver.com/docs/docP ... Safety.htm
Lapo
--
gotoAndPlay()
...addicted to flash games
Ganius
Posts: 92
Joined: 13 Feb 2007, 12:49

Post by Ganius »

Is there any message returned for a user that has been banned? If not, is there some indication of banned users (either banned by username or IP) trying to connect and log in?

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

Post by Lapo »

Yes, the user receives a login error message that is customizable via the config.xml ( <BannedLoginMessage> )
Lapo
--
gotoAndPlay()
...addicted to flash games
Ganius
Posts: 92
Joined: 13 Feb 2007, 12:49

Post by Ganius »

Forgot about that one!! ;-)

But I was thinking more along the lines of server-side logging/notification/messages etc. So we can see if a banned user is trying to gain access but is being denied due to their ban. Is there anything like that?

Also, is there a limit to the number that can be entered into the <BanDuration> tag?

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

Post by Lapo »

No there isn't
<BanDuration> is a signed integer, so it goes up to 2^31
Lapo
--
gotoAndPlay()
...addicted to flash games
Post Reply