Created
August 14, 2012 13:19
-
-
Save alexesDev/3349185 to your computer and use it in GitHub Desktop.
Send BufferProtocol message in Qt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Protocol::Request request; | |
request.mutable_island()->mutable_binoms()->set_id(99999); | |
request.mutable_island()->mutable_heigthmap()->set_id(1111); | |
std::ostringstream messageStream; | |
request.SerializeToOstream(&messageStream); | |
QByteArray block; | |
QDataStream out(&block, QIODevice::WriteOnly); | |
out.setVersion(QDataStream::Qt_4_8); | |
out << (quint16)0; | |
out << messageStream.str().c_str(); | |
out.device()->seek(0); | |
out << (quint16)(block.size() - sizeof(quint16)); | |
socket->write(block); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment