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 < [email protected]> 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 < > [email protected]> 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 >> [email protected] >> http://lists.cubik.org/mailman/listinfo/enet-discuss >> >> > _______________________________________________ > ENet-discuss mailing list > [email protected] > http://lists.cubik.org/mailman/listinfo/enet-discuss > >
_______________________________________________ ENet-discuss mailing list [email protected] http://lists.cubik.org/mailman/listinfo/enet-discuss
