|
You last visited: Today at 22:28
Advertisement
Receiving packets
Discussion on Receiving packets within the CO2 Private Server forum part of the Conquer Online 2 category.
09/24/2011, 11:17
|
#1
|
elite*gold: 0
Join Date: May 2011
Posts: 1,769
Received Thanks: 756
|
Receiving packets
When I receive a packet I do something like this:
Code:
public static void NewPacket(SocketClient Client, byte[] Packet)
{
if (Kernel.SafePacket(Client, Packet))
{
//Handle
}
}
Code:
public static bool SafePacket(SocketClient Client, byte[] Packet)
{
if (Client == null || Packet == null)
return false;
return (Packet.Length > 0 && Packet.Length <= MaxPacketSize);
}
But would it take more resources or it wouldn't matter, if so is there other ways that's better?
|
|
|
09/24/2011, 17:34
|
#2
|
elite*gold: 0
Join Date: Apr 2009
Posts: 782
Received Thanks: 458
|
well... other thing you could do is:
Code:
public static bool SafePacket(SocketClient Client, byte[] Packet)
{
if (Client == null || Packet == null)
return false;
if (Packet.Length > 0 && Packet.Length <= MaxPacketSize);
{
Proccess(Client, Packet);
return true;
}
else return false;
}
//----------------------------------
static void Proccess(SocketClient Client, byte[] Packet)
{
//Handle
}
|
|
|
09/24/2011, 18:05
|
#3
|
elite*gold: 0
Join Date: May 2011
Posts: 1,769
Received Thanks: 756
|
Quote:
Originally Posted by 12tails
well... other thing you could do is:
Code:
public static bool SafePacket(SocketClient Client, byte[] Packet)
{
if (Client == null || Packet == null)
return false;
if (Packet.Length > 0 && Packet.Length <= MaxPacketSize);
{
Proccess(Client, Packet);
return true;
}
else return false;
}
//----------------------------------
static void Proccess(SocketClient Client, byte[] Packet)
{
//Handle
}
|
Would do no difference xD
|
|
|
09/24/2011, 18:11
|
#4
|
elite*gold: 0
Join Date: Jun 2009
Posts: 787
Received Thanks: 314
|
doesn't matter in the least (maybe if you're worrying about 100s of cpu cycles, if so you shouldn't be using C#), you've got bigger problems to worry about.
|
|
|
09/24/2011, 18:48
|
#5
|
elite*gold: 0
Join Date: May 2011
Posts: 1,769
Received Thanks: 756
|
Quote:
Originally Posted by _tao4229_
doesn't matter in the least (maybe if you're worrying about 100s of cpu cycles, if so you shouldn't be using C#), you've got bigger problems to worry about.
|
The bigger problems is? xD
|
|
|
09/24/2011, 21:33
|
#6
|
elite*gold: 12
Join Date: Jul 2011
Posts: 8,282
Received Thanks: 4,191
|
Shouldn't your packet splitter be doing this?
*if you have one. There are other ways of splitting packets.
Look at Kibou if you're interested. I removed it recently because of a Turk that tried releasing it. If you need it, just msn me or comment on my blog.
|
|
|
09/24/2011, 21:37
|
#7
|
elite*gold: 0
Join Date: May 2011
Posts: 1,769
Received Thanks: 756
|
Quote:
Originally Posted by Fаng
Shouldn't your packet splitter be doing this?
*if you have one. There are other ways of splitting packets.
Look at Kibou if you're interested. I removed it recently because of a Turk that tried releasing it. If you need it, just msn me or comment on my blog.
|
Not using a packetsplitter. And sure I would like to take a look, thanks ^^
|
|
|
09/24/2011, 22:12
|
#8
|
elite*gold: 0
Join Date: Feb 2011
Posts: 335
Received Thanks: 170
|
Just take a look at Kibou, Kanji. They are perfect.
|
|
|
09/24/2011, 22:15
|
#9
|
elite*gold: 12
Join Date: Jul 2011
Posts: 8,282
Received Thanks: 4,191
|
Quote:
Originally Posted by Arco.
Just take a look at Kibou, Kanji. They are perfect.
|
.-. There's no such thing has "perfect"...
And I've learned a lot since Kibou and Kanji.
|
|
|
09/24/2011, 22:16
|
#10
|
elite*gold: 0
Join Date: Feb 2011
Posts: 185
Received Thanks: 55
|
My long, lost brother is back.
/ontopic
" " //Kibou has a great example
|
|
|
 |
Similar Threads
|
[Question]about receiving from the Client
06/03/2011 - CO2 Private Server - 12 Replies
well am working on a (C++)Socket for the newest client and i have noticed something that i should wait like 1-2 secs after sending the SeedPacket to the Client in order to receive anydata . is that true? , or my receiving method bugged somehow!!!
|
[MUST READ] TO AVOID RECEIVING WARNING / INFRACTION
08/30/2009 - Grand Chase - 2 Replies
Greetings co-Elitepvpers,
as GC MODERATORS of this SECTION it's our job to keep this section clear from any SPAM, WRONG POSTS, FLAMES, RUDE POSTS, INSULTS, and the LIKES...
so we need to issue you WARNING or INFRACTION for violating rules not to OFFEND you but to DISCIPLINE you... so please don't be mad at us...
we will not give you WARNING and INFRACTION for NO REASON and we are NOT abusing our POWER as well if that's what you think... so to PREVENT us from issuing you those latter...
|
Receiving quest reward with DC
12/13/2007 - Cabal Online - 8 Replies
Hi i have an idea how to receive the quest rewards with DC. But i don't know exactly is it working.
1. You do a quest, lets say you must collect 5 quest items
2. Go to an NPC with all items.
3. When you are finishig the quest, dissconect your PC from the internet.
4. When you relog in you will see that you have 4/5 quest items and you received the quest reward.
I had that few times. Can someone check it? If it does work it's a good possybility to earn a lot of alz without killing too...
|
All times are GMT +1. The time now is 22:28.
|
|