[ENet-discuss] A query about channels

Ruud van Gaal ruud at racer.nl
Sun Jan 17 12:33:55 PST 2010


...
> "cmd" field as the first field in the struct being sent, my 
> only concern is what happens to the rest of the "trash" data 
> after first memcpy. E.g., StructA and StructB, StructB is 
> bigger than StructA, both have the first field as a "char 
> cmd", but the rest of the data causes the structs to not be 
> the same size.

You can use a union so all structs are maxed out. However, I would advise a
packet class. I send strings as: short len; char data[]; which is variable
length, so no struct can catch those. Going for worst case means very bad
things when trying to send over strings...

Ruud



More information about the ENet-discuss mailing list