[Problem] Authentication to GameServer

08/29/2010 11:04 -Fáng-#1
Hey Everyone,

I don't write often about problems that I'm having... but I've been at this for days researching this problem. First, you must know that the structure of my server is much like CoEmu. It is split up into two servers: a login server and a world server. Secondly, you must know that my socket system problem isn't just one problem, but many huge problems that I can't find the root of.

This is what I have found out through backtracking:

1. The problem isn't with the login server. The login server sends the correct key and information to the world server successfully every time.

2. The world server picks up the key and information correctly and sets the ASocket in the connection request handler.

3. The Connection Request system then picks it up successfully and records the key for research use.

4. It then adds the key to Authenticated Logins after checking to see if it's already in the system. The user is entering the game server now and the client starts to initialize... This is where it goes wrong.

5. The Login Handler now starts... if the information did not make it, then it stops the client at "initializing" and never enters the game server. The case that handles the login handler in the packet processor is case 1052. This is meant to end the authorization process and load the character into the game server.

If it doesn't pick it up... the client process bar will not move and the server will report that the connection is being dismissed (Timed Out in CoEmu talk). This is just one of the major problems with the login process of Conquer Online New Dawn.

Help is appreciated.
-Fang

PS: What happens if you run 32,577 threads on the server? What is the comparison to running 18? I know this is extreme... but that's what my server can hold. Thanks.
08/29/2010 12:45 Korvacs#2
So whats the problem? I read all of it twice and couldnt find an issue, if the server didnt get the info then it kicks the client, thats a good thing...

Threads wise, since every thread tries to occupy CPU Time, there will be a point where more threads makes the server less efficient. See there is no limit to the number of software threads you can make, but your processor can only handle (in alot of cases) 2 threads per core, per time interval, this doesnt sound like alot however the cpu will adjust the time interval to compensate for the number of software threads which are active. So like i say, at some point you'll find your threads arnt getting enough CPU Time, at which point you'll have reached the tipping point and it will all be down hill from there.

32,577 Sounds like its going to cause issues, most apps dont use more than 100, and the less threads you use the more CPU Time each of them can have so a server running 18 will keep the crap outta a server running 32,577. Also how can your server "hold" 32,577 did you limit it to that number? Or what.
08/29/2010 13:09 _DreadNought_#3
His problem(I think) is that when you login you never log stright in, you have to login 2x to get in game?
08/29/2010 13:10 -Fáng-#4
Quote:
Originally Posted by Korvacs View Post
So whats the problem? I read all of it twice and couldnt find an issue, if the server didnt get the info then it kicks the client, thats a good thing...

Threads wise, since every thread tries to occupy CPU Time, there will be a point where more threads makes the server less efficient. See there is no limit to the number of software threads you can make, but your processor can only handle (in alot of cases) 2 threads per core, per time interval, this doesnt sound like alot however the cpu will adjust the time interval to compensate for the number of software threads which are active. So like i say, at some point you'll find your threads arnt getting enough CPU Time, at which point you'll have reached the tipping point and it will all be down hill from there.

32,577 Sounds like its going to cause issues, most apps dont use more than 100, and the less threads you use the more CPU Time each of them can have so a server running 18 will keep the crap outta a server running 32,577. Also how can your server "hold" 32,577 did you limit it to that number? Or what.
That doesn't seem right at all Korvacs. If the server didn't get the info then that's a bad thing because it's supposed to send it so the client can reach the game server. You obviously did not read this twice. And as far as threads go... you must be mistaken. My server is running 5 threads at all times to handle the server and they are being used at the same time. I have a dual core. Also, as I said, the "32,577" is the number that my server says it can handle. I don't know how it could and I know it will crash my computer before it could... but the server itself can handle 32,577 threads. Anyways, I was just curious. The login problem is my concern. All I know is that it's something to do with linking the auth ok to the game server.
08/29/2010 13:45 Korvacs#5
Quote:
Originally Posted by -Fáng- View Post
That doesn't seem right at all Korvacs. If the server didn't get the info then that's a bad thing because it's supposed to send it so the client can reach the game server. You obviously did not read this twice. And as far as threads go... you must be mistaken. My server is running 5 threads at all times to handle the server and they are being used at the same time. I have a dual core. Also, as I said, the "32,577" is the number that my server says it can handle. I don't know how it could and I know it will crash my computer before it could... but the server itself can handle 32,577 threads. Anyways, I was just curious. The login problem is my concern. All I know is that it's something to do with linking the auth ok to the game server.
The reason its a good thing is because the client sends the data, so if the client doesnt send the data then the server kicks the client, thats good. If the reason your not receiving the data is because of your socket server, then you need to output all of the decrypted data your receiving from the socket and check that your actually receiving your 1052 if you are then track the data by debugging and see where you loose it. You have a load of tools available for you, the console is Key for debugging, just output the packet as you go through your methods and see where your going wrong.

As for your threads no im not mistaken, all threads share CPU Time, they dont all run at the same time, a thread takes a fraction of the CPU Time, and then the next thread gets some CPU Time, then the next one, and so on and so on. A typical server (not limited to Conquer servers) should use in the region of 15/20 threads, there simply is no need for more, a massive server on a Hardware Multi-CPU motherboard (4 physical cpus, 16 cores?) No more than 200 really. Dunno why you think your server can handle 32.5k, dunno why you mentioned it really..
08/29/2010 13:59 ImmuneOne#6
Your Auth->Game Sequence;
Quote:
CoClient -> AuthSocket (LoginRequest)
AuthSocket -> CoClient (LoginReply) // Key 3 = Banned, 2 = Correct, 1 = Wrong password
AuthSocket -> GameSocket (Connection_Request)
CoClient -> GameSocket (OnGameConnect)
Supposed to be;
Quote:
CoClient -> AuthSocket (LoginRequest)
AuthSocket -> CoClient (LoginReply) // Key 3 = Banned, 2 = Correct, 1 = Wrong password
CoClient -> GameSocket;
(OnGameConnect)
Quote:
[StructLayout(LayoutKind.Sequential, CharSet=Ansi)]
struct OnGameConnect
{
public PacketHeader Header; //Contains PSize, PType
public UInt32 Connection_ID; //Connection ID sent by AuthSocket to CoClient
public UInt32 Connection_Key; //Connection key sent by AuthSocket to CoClient
[MarshalAs(UnmanagedType.ByValTStr, SizeConst=16)]
public String Connection_Message;//Informs you about client's language
}
if Connection_ID == 0
SendMsg("Un-authorized connection!");
if Connection_Key == 3
SendMsg("You are banned!");

LoadHero(GamePacket.Connection_ID, Client);
There is no need at all to create an extra socket.
08/29/2010 15:50 µ~Xero~µ#7
Weird CoEmu coding. But yeah Andy always coded messy sockets :rolleyes:

Fang.. you might implement Hybrids Socket System. (there is a version for blowfish out already)
08/29/2010 15:54 Kiyono#8
Quote:
Originally Posted by µ~Xero~µ View Post
Weird CoEmu coding. But yeah Andy always coded messy sockets :rolleyes:

Fang.. you might implement Hybrids Socket System. (there is a version for blowfish out already)
Really? I've been watching this forum for quite some time and never saw it being posted.
08/29/2010 16:38 µ~Xero~µ#9
by InFlamedCo
08/29/2010 17:40 Arcо#10
Quote:
Originally Posted by Kiyono View Post
Really? I've been watching this forum for quite some time and never saw it being posted.
Yup InflamedCOD released one, its the one I used to upgrade hybrids source past 5017.
08/29/2010 17:53 Kiyono#11
Quote:
Originally Posted by .Arco View Post
Yup InflamedCOD released one, its the one I used to upgrade hybrids source past 5017.
I did some searching and found it, I even posted in the thread but I just forgot about it lol
08/29/2010 19:29 -Fáng-#12
Hm... well my socket system is fast... really fast. If the other socket system is better though... how on earth would I implement that for CoEmu. It's a one project system is it not?

ImmuneOne, what socket system are you using in your unfinished project?
08/29/2010 19:40 µ~Xero~µ#13
YOu can always port the sockets. and Immune had his own.
08/29/2010 19:45 Korvacs#14
Quote:
Originally Posted by -Fáng- View Post
Hm... well my socket system is fast... really fast. If the other socket system is better though... how on earth would I implement that for CoEmu. It's a one project system is it not?

ImmuneOne, what socket system are you using in your unfinished project?
The socket class in any server tends to be a fairly seperate entity, you should be able to convert it fairly easily really.
08/29/2010 19:47 -Fáng-#15
Ok, well I'll look into it then. What are the advantages of using that socket system though?