<div dir="ltr">Hi Ian,<div><br></div><div>To me it seems this is a serialisation problem that is</div><div><br></div><div>sizeof(MyStructure) =/= size of data written into the ENet packet?</div><div><br></div><div>I can assure you that I have yet to have seen that writing 4 bytes into a packet data block has arrived as 8 or other. Bytes in == bytes out.</div><div><br></div><div>What I would consider instead is writing the data one by one (using your own integer/float/string serialisation routines) and maybe using pragma pack 1 for your structures, making sure that the structure is not byte-padded by the compiler for performance memory access reasons?</div><div><br></div><div>I hope I have understood your question properly.</div><div><br></div><div>Best regards,</div><div><br></div><div>Pablo</div><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Dec 18, 2014 at 6:59 PM, Ian Wiles <span dir="ltr"><<a href="mailto:ian.alexander.wiles@googlemail.com" target="_blank">ian.alexander.wiles@googlemail.com</a>></span> wrote:<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><span style="font-size:13px">Hi,</span><div style="font-size:13px"><br></div><div style="font-size:13px">I've started using enet recently, using the pre-built libs for VC++. I'm trying to pack an object that is designed for transport over the wire, but after comparing the object with enet's packet->data the object, which is 4 bytes, grows by 4 bytes. Is there a minimum size for packet creation? I can apply a bit mask for now but it's not scalable since any additional data will change. I had no trouble sending a struct over so maybe I need to serialize the objects properly. Any advice would be good,</div><div style="font-size:13px"><br></div><div style="font-size:13px">Cheers,</div><div style="font-size:13px">Ian</div></div>
<br>_______________________________________________<br>
ENet-discuss mailing list<br>
<a href="mailto:ENet-discuss@cubik.org">ENet-discuss@cubik.org</a><br>
<a href="http://lists.cubik.org/mailman/listinfo/enet-discuss" target="_blank">http://lists.cubik.org/mailman/listinfo/enet-discuss</a><br><br></blockquote></div><div class="gmail_signature"></div>
</div></div>