Register for your free account! | Forgot your password?

Go Back   elitepvpers > MMORPGs > Conquer Online 2 > CO2 Private Server
You last visited: Today at 02:11

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

Advertisement



[Discussion] Packet writing methods

Discussion on [Discussion] Packet writing methods within the CO2 Private Server forum part of the Conquer Online 2 category.

Reply
 
Old   #1
 
elite*gold: 0
Join Date: Jul 2010
Posts: 37
Received Thanks: 8
[Discussion] Packet writing methods

I noticed alot of sources that have been released to public use the accessor method, which was been presented by Hybrid back then. I'm curious which method you personally use, and for what reason. My personal choice is structured packets. Example;
Code:
        [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi)]
        struct LoginResponse
        {
            public PacketHeader Header;
            public UInt32 Key;
            public UInt32 ID;
            [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 16)]
            public String IP;
            public UInt16 Port;
            public UInt16 Blank;
        }

        public byte[] ToArray()
        {
            Filler = new PacketFiller(Marshal.SizeOf(Response));
            Filler.FillPacket<LoginResponse>(Response);
            return Filler.ToArray();
        }
Looking forward to your feedback.
InfamousGeek is offline  
Old 08/01/2010, 19:13   #2
 
elite*gold: 0
Join Date: Jun 2009
Posts: 787
Received Thanks: 314
or Send(&Response, Response.Header.Size/Marshal.SizeOf(Response));
_tao4229_ is offline  
Old 08/01/2010, 19:18   #3
 
elite*gold: 0
Join Date: Jul 2010
Posts: 37
Received Thanks: 8
Quote:
Originally Posted by _tao4229_ View Post
or Send(&Response, Response.Header.Size/Marshal.SizeOf(Response));
Code:
        public PacketFiller(Int32 Size) //When I call the constructor I use Marshal.SizeOf
        {
            Packet = new byte[Size];
        }

        public void FillPacket<TStruct>(TStruct Struct)
        {
            IntPtr Ptr = Marshal.AllocHGlobal(Packet.Length);
            Marshal.StructureToPtr(Struct, Ptr, false);

            fixed (byte* pckt = this.Packet)
            {
                Native.memcpy(pckt, Ptr.ToPointer(), Packet.Length);
            }
        }
If you don't mind if I ask, which method do you use?
InfamousGeek is offline  
Old 08/01/2010, 20:21   #4
 
elite*gold: 0
Join Date: Jun 2009
Posts: 787
Received Thanks: 314
Quote:
Originally Posted by InfamousGeek View Post
Code:
        public PacketFiller(Int32 Size) //When I call the constructor I use Marshal.SizeOf
        {
            Packet = new byte[Size];
        }

        public void FillPacket<TStruct>(TStruct Struct)
        {
            IntPtr Ptr = Marshal.AllocHGlobal(Packet.Length);
            Marshal.StructureToPtr(Struct, Ptr, false);

            fixed (byte* pckt = this.Packet)
            {
                Native.memcpy(pckt, Ptr.ToPointer(), Packet.Length);
            }
        }
If you don't mind if I ask, which method do you use?
I import WSASend/send (from ws2_32) and just pass a pointer to the structure.
_tao4229_ is offline  
Old 08/01/2010, 21:45   #5
 
© Haydz's Avatar
 
elite*gold: 20
Join Date: Jan 2008
Posts: 1,042
Received Thanks: 252
Quote:
Originally Posted by _tao4229_ View Post
I import WSASend/send (from ws2_32) and just pass a pointer to the structure.
Same as above.
© Haydz is offline  
Old 08/01/2010, 22:11   #6
 
elite*gold: 0
Join Date: Jul 2010
Posts: 37
Received Thanks: 8
Quote:
Originally Posted by _tao4229_ View Post
I import WSASend/send (from ws2_32) and just pass a pointer to the structure.
I considered writing a winsocket, though my personal opinion is that there is no need to reinvent the wheel.
InfamousGeek is offline  
Old 08/01/2010, 23:56   #7


 
Korvacs's Avatar
 
elite*gold: 20
Join Date: Mar 2006
Posts: 6,126
Received Thanks: 2,518
Quote:
Originally Posted by InfamousGeek View Post
I considered writing a winsocket, though my personal opinion is that there is no need to reinvent the wheel.
If you can improve on the original wheel then why not?
Korvacs is offline  
Old 08/02/2010, 00:03   #8
 
elite*gold: 0
Join Date: Jun 2009
Posts: 787
Received Thanks: 314
Quote:
Originally Posted by InfamousGeek View Post
I considered writing a winsocket, though my personal opinion is that there is no need to reinvent the wheel.
If you don't feel like reinventing the wheel, you can just import the function and pass a System.Net.Socket.Handle as the SOCKET s param.
_tao4229_ is offline  
Old 08/02/2010, 14:52   #9
 
elite*gold: 0
Join Date: Jul 2010
Posts: 37
Received Thanks: 8
Quote:
Originally Posted by Korvacs View Post
If you can improve on the original wheel then why not?
Then it's not reinventing the wheel.. anyhow, we could discuss this forever but there is no point since every programmer has his own methods.

Quote:
Originally Posted by _tao4229_ View Post
If you don't feel like reinventing the wheel, you can just import the function and pass a System.Net.Socket.Handle as the SOCKET s param.
I might give it a shot..
InfamousGeek is offline  
Old 08/03/2010, 16:34   #10
 
Nullable's Avatar
 
elite*gold: 0
Join Date: Nov 2009
Posts: 390
Received Thanks: 321
Same method, but i usually don't program in managed. It is a lot easier in native.
Nullable is offline  
Reply


Similar Threads Similar Threads
[DISCUSSION] Packet sending
11/07/2009 - Grand Chase - 6 Replies
I was thinking... Would it be possible to edit sending and recieving things for GC... I know they have a woo (Window of Opportunity) of a few seconds.. Hence the lag trick in PvP. but if you get an automated macro to do everything under a second... like re edit the batch files (or cookies or what ever) to send "manipulated" files.. such as "This person recieved 1mill exp in that run" etc... This is not hacks it's programing, so im not sure if im in the right place or if anyone is...
Writing own packet bot - Questions
08/06/2009 - Kal Online - 18 Replies
Hello, I've just started writing a packet bot, but already have many problems that cant solve. Coordinates As you know packet bot does not affect on client coords. So I cant read fresh coords this way: MemcpyEx((DWORD)&Coords.X, DWORD(((DWORD)*speedpointer)+0x000046AC),4); MemcpyEx((DWORD)&Coords.Y, DWORD(((DWORD)*speedpointer)+0x000046B4),4); MemcpyEx((DWORD)&Coords.Z, DWORD(((DWORD)*speedpointer)+0x000046B0),4); printf("Position %d, %d, %d....
T>aegis duping methods for eAthena methods
03/21/2009 - Ragnarok Online - 0 Replies
pm for details
Rohan Hacks w/ Packet Editing Discussion
01/23/2009 - Rohan - 0 Replies
I've been trying to hack the game using packets instead of memory editing. Basically the game doesn't send a packet for every hit or movement. Instead it periodically sends 2 packets and receives 1. (Does this every 2 seconds or so) regardless of skill casting, using items, dropping or picking up stuff, etc. Also the check sums are long and not simple. Anyone have any ideas as to how to continue?



All times are GMT +1. The time now is 02:13.


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.