Packets are not typically received in a specific thread.
Rather, an event is generated when a packet is received. Something like the kind of event that is generated on a form when you click a button. It's not technically a thread but it kind of acts like one. Completely independent of the main part of the program.
This depends on your chosen platform though I guess.
There should never be any kind of error when a lot of packets are received since the packets are queued so you will only ever receive on at a time.
The tricky bit is actually in processing them. That's where you might need threading although it can be worked around by using the packets to set flags which can be read by the main loop later.
If a player use a packet reader he would modify one packet and send a lot of packets but rose use some algorith to encrypt the packets client to server and server to client. Of course, it's a matter of blindly taking risks :stupid:Hello, I'm programming a new client of Rose on another platform, but I have a doubt with the system packets.
I wanted to know how to receive packets from the Client's original Rose works.
It uses multi-threads to receive the packets or just one thread?
*NOTE: Ask on this because I believe that with only one thread can give some kind of error if the server send many packets at the same time to the same client.
If you can help thank you in!
BOOL APIENTRY DllMain( HANDLE ,
DWORD ul_reason_call,
LPVOID
)
{
switch (ul_reason_call)
{
case THREAD_ATTACH:
if ( [COLOR=#ff0000]conditions [/COLOR]) {
[COLOR=#008000]instructions[/COLOR];
}
case 2:
break;
}
return TRUE;
}
Hello.
You're on something pretty big here.
About the way server works with packets, you have the gameserver that uses a switch that looks like that
Code:BOOL APIENTRY DllMain( HANDLE , DWORD ul_reason_call, LPVOID ) { switch (ul_reason_call) { case THREAD_ATTACH: if ( [COLOR=#ff0000]conditions [/COLOR]) { [COLOR=#008000]instructions[/COLOR]; } case 2: break; } return TRUE; }
there is also a static int that count the number of calls. Usefull to avoid some hacks like the mentioned zulytower earlier, you might use some sleep function to aviod having it working 100% of time tho.
thats kinda how it works. But you have to know that the server is divided in 3 parts.
One doing logging in.
Another about loading the world data, (NPCs, maps objets etc.)
And a last one that allow the final connection ( channel.. ) & has most of packets trafic.
All of those 3 are linked and can't work independently tho.
Hope it helped.
Hij.
switch(pakID())
{
case 0x78FFA5:
procMov(pack);
return true;
}
return false;
packetNPC (npcIDX, mapID, X, Y )
Client -> Server
packID = 0x0x78FFA5
float x = 1000.0 (example)
float Y = 1891.12 (example)
float Z = 5.0 (example)
Verification Server
if (X <= 1000 && y <= 1000 && Z <= 500)
Server -> Client (Map Packet)
int userID
float X
float Y
float Z
D3DXMatrixTranslation(&t_m,x, y, z);
D3DXMatrixScaling (&s_m,r, r, r);
model_p = s_m * t_m;