Hi!
sorry for late reply, had a lack of time.
sock.Send() does not take ownership of passed in buffer, so, after calling the method, the buffer does not have to remain existing.
Because of that, the bes would be to do the very first thing you proposed, but you probably have to cast char to ting::u8:
string st = "1121212";
ting::Buffer<ting::u8> buf(reinterpret_cast<ting::u8*>(st.c_str()), st.size());
sock.send(buf);
and you need to use size() because you are sending bytes over the network, not characters.
Serializing the object is a thing with is out of ting library scope, you have to do it yourself before sending over the network. The essence of serialization is that you need to "pack" all relevant data of the object to ting::Buffer<ting::u8> which can later be sent. And on the other end, after receiving the bytes, you have to "unpack" the date and fill in the fields of your object. That is the idea. This "packing" and "unpacking" you generally have to do by hand.
Hope that helps.
Br,
Ivan
вторник, 7 января 2014 г., 15:44:19 UTC+2 пользователь Gall Anonim написал: