[ENet-discuss] Packet Data query

Pablo de Heras Ciechomski pablo.deheras at gmail.com
Sun Jan 4 07:20:28 PST 2015


Thanks for getting back Ian.

Happy that it helped.

Pablo
On 4 Jan 2015 15:47, "Ian Wiles" <ian.alexander.wiles at googlemail.com> wrote:

> Hi Pablo,
>
> I broke everything down into a byte buffer and also used pragma pack 1 for
> my structs and it works as expected now.
>
> Thanks,
> 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
>>
>>
>
> _______________________________________________
> 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/20150104/de7acfe2/attachment.html>


More information about the ENet-discuss mailing list