Register for your free account! | Forgot your password?

You last visited: Today at 22:28

  • Please register to post and access all features, it's quick, easy and FREE!

Advertisement



Receiving packets

Discussion on Receiving packets within the CO2 Private Server forum part of the Conquer Online 2 category.

Reply
 
Old   #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?
BaussHacker is offline  
Thanks
1 User
Old 09/24/2011, 17:34   #2
 
12tails's Avatar
 
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
            }
12tails is offline  
Old 09/24/2011, 18:05   #3
 
elite*gold: 0
Join Date: May 2011
Posts: 1,769
Received Thanks: 756
Quote:
Originally Posted by 12tails View Post
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
BaussHacker is offline  
Old 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.
_tao4229_ is offline  
Thanks
1 User
Old 09/24/2011, 18:48   #5
 
elite*gold: 0
Join Date: May 2011
Posts: 1,769
Received Thanks: 756
Quote:
Originally Posted by _tao4229_ View Post
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
BaussHacker is offline  
Old 09/24/2011, 21:33   #6
 
Spirited's Avatar
 
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.
Spirited is offline  
Old 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 View Post
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 ^^
BaussHacker is offline  
Old 09/24/2011, 22:12   #8
 
Arco.'s Avatar
 
elite*gold: 0
Join Date: Feb 2011
Posts: 335
Received Thanks: 170
Just take a look at Kibou, Kanji. They are perfect.
Arco. is offline  
Old 09/24/2011, 22:15   #9
 
Spirited's Avatar
 
elite*gold: 12
Join Date: Jul 2011
Posts: 8,282
Received Thanks: 4,191
Quote:
Originally Posted by Arco. View Post
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.
Spirited is offline  
Old 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
Yup Stigs is offline  
Thanks
1 User
Reply


Similar Threads 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.


Powered by vBulletin®
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
SEO by vBSEO ©2011, Crawlability, Inc.
This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

Support | Contact Us | FAQ | Advertising | Privacy Policy | Terms of Service | Abuse
Copyright ©2025 elitepvpers All Rights Reserved.