[ENet-discuss] Packet Data query

Ian Wiles ian.alexander.wiles at googlemail.com
Fri Dec 19 08:33:58 PST 2014


Hi Pablo,

Thanks for that. Yes, it looks like something is going wrong packing the
object since I'm not serialising it in a well defined way, whereas my
struct was ok. So I'll need to go back to the drawing board with the
serialisation of objects. I'll also try pragma pack 1, thanks I wasn't
aware of that, so it's something to try.

Cheers
Ian

On Fri, Dec 19, 2014 at 3:08 PM, Pablo de Heras Ciechomski <
pablo.deheras at gmail.com> wrote:
>
> Hi Ian,
>
> To me it seems this is a serialisation problem that is
>
> sizeof(MyStructure) =/= size of data written into the ENet packet?
>
> 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.
>
> 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?
>
> I hope I have understood your question properly.
>
> Best regards,
>
> Pablo
>
> On Thu, Dec 18, 2014 at 6:59 PM, Ian Wiles <
> ian.alexander.wiles at googlemail.com> wrote:
>
>> Hi,
>>
>> 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,
>>
>> Cheers,
>> Ian
>>
>> _______________________________________________
>> ENet-discuss mailing list
>> ENet-discuss at cubik.org
>> http://lists.cubik.org/mailman/listinfo/enet-discuss
>>
>>
> _______________________________________________
> ENet-discuss mailing list
> ENet-discuss at cubik.org
> http://lists.cubik.org/mailman/listinfo/enet-discuss
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.cubik.org/pipermail/enet-discuss/attachments/20141219/6fd19d8a/attachment.html>


More information about the ENet-discuss mailing list