(C++/winsock) Packaging alternative to structs -
i have used structs packaging , receiving packets, gain converting them classes inherited main packet class ? there "c++ish" way packaging , performance gain ?
it general , various solutions may available. related serialization topic , simple model of serialization packets contains structs can loaded directly memory , vice versa. think c , c++ great in case because allow write struct directly stream , read easily. in other languages can implement byte alignment or should serialize objects able write them streams.
in cases need read string stream xml, soap, etc. in application should use structs. in cases need serialize objects stream. depends. think using structs , pointers more forward using object serialization.
in case, have 2 structures each entity think. struct moved along wire or file , class holds entity instance inside memory. if use binary serialization object, can use class sending, receiving , keeping instance.
Comments
Post a Comment