It depends really. There's plenty of viable and effective ways of writing packets.
From a pure efficiency standpoint, I'm under the impression that structs and memory marshaling are likely king. I do know that it gets very painful to work with as soon as you start delving into variable offset packets though and therefor are less 'worth it'.
Personally I feel pointers are the best route to take and is actually what the TQ servers use (look at the NetStringPacker in Albetros source, that's ripped from tq sources by dev).
It really depends on what you value. What's most efficient for one packet (simple fixed offset/length packets) might be less efficient or difficult to work with on another (variable number of variable length strings for example)
Sequential structures using a packing of one byte. For packets with variable length strings, putting a fixed char array of one byte at the end to use with a StringPacker would do the trick. After that, you can alloc the structure on the heap and cast it to an unsafe byte pointer OR you can stackalloc the structure and copy it to a managed byte array.
That's the way I mostly did it, and that's the way I would go.
i think u must use the way that is easier for u to use, actually almost every way to write packets are fast and don't has much memory usage, the difference won't be much, but the difficulty to structure them will be. (ofc this will apply in cases that u aren't writing an extremly crappy code)
Ease of use would be the ease at which it is to write and maintain packet structures and how to access the data and manage it etc. So that would most likely be a class, a byte[] and a base class which each packet inherits from.
For speed of creation I would suggest a class with a pointer based system and you should implement a native method to send by pointer, instead of converting to array.
And for memory its a struct being used as a pointer, but which has a fixed layout.
[Release] +5500 Packets structure , client/packets constants 10/07/2012 - CO2 PServer Guides & Releases - 10 Replies edit : if u know nothing about packets go to this post first
explaining what is packets , and explaining a packet with details and everything
http://www.elitepvpers.com/forum/co2-pserver-disc ussions-questions/2162344-packets-packets-packets. html#post19074533
i start making my very own packet structure to use them on my new proxy but i thought of ripping them from the source
so yeah the following packets is ripped of trinity base source
right now im just providing the packets structure...
[Packets] Wie änder ich flyff packets? 07/16/2011 - Flyff Private Server - 19 Replies HeyHo,
Ich würde sehr gerne wissen wie man die Flyff Packets ändert...
ich denke mal Zahlen ändern werden nicht ausreichen oder?
What is the most effective bot? VOTE 09/25/2008 - Archlord - 9 Replies Please ... vote .. which bot is best for you?
Edited: If you choise "Other" write the name!!
OLD but still effective 03/06/2007 - CO2 Exploits, Hacks & Tools - 30 Replies Simple just plv a tao and lv thunder to lv 3+ and go to rb spot(on your way to skypass is where it is), then when u see rb msg just log and BAM zap em once adn there dead and chacne to drop super gemmy or gears^^....like i said this is old but just recently i got a super 2sock brac +3 so thsi scam obviously still works:)......Lastly another way u can do this but it MAY not work is plv a water tao (lv 70 will suffice) and just kill adn rev and kill, only problem with this is that when reved...