I would like to dip into Google’s protocol buffers in Qt development, but I am having trouble figuring out how to incorporate them best.
Ultimately, I want to send with QUdpSocket and QTcpSocket using protocol buffers.
What is the best method for going between a protocol buffer message to sending the data over a socket (QByteArray) and then back again at the other side?
Instead of:
you can also write:
EDIT: Above two gives the same result, but I’m not sure wether it’s correct. This one seems to work better:
EDIT2: OK, now I know how it works: first two ways are wrong if there are \0 char in serialization – everything after it it’s then lost. To correct it one can write: