Skip to content

Commit

Permalink
fix: only write mode
Browse files Browse the repository at this point in the history
  • Loading branch information
frank1789 committed Feb 8, 2020
1 parent 602b8aa commit d2dab00
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions src/socket/commonconnection.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ void send_message_text(QTcpSocket *socket, const QString &message) {
}
// prepare datastream
QByteArray ba_message;
QDataStream out(&ba_message, QIODevice::ReadWrite);
QDataStream out(&ba_message, QIODevice::WriteOnly);
out.setVersion(QDataStream::Qt_4_0);
// serialize information
out << QString(GROUP_SEPARATOR_ASCII_CODE)
Expand All @@ -64,18 +64,18 @@ void send_message_image(QTcpSocket *socket, const QImage &image) {
#endif
return;
}
// prepare datastream

// prepare datastream and serialize information
QByteArray ba_message;
QDataStream out(&ba_message, QIODevice::ReadWrite);
QDataStream out(&ba_message, QIODevice::WriteOnly);
out.setVersion(QDataStream::Qt_4_0);
// serialize information
out << QString(RECORD_SEPARATOR_ASCII_CODE)
<< static_cast<quint32>(image.sizeInBytes()) << image;
socket->write(ba_message);
#if LOGGER_CLIENT || LOGGER_SERVER
LOG(DEBUG, "sending image:")
LOG(TRACE, "serialized image")
qDebug() << "\theader: " << QString(RECORD_SEPARATOR_ASCII_CODE)
<< "\tsize:" << static_cast<quint32>(image.sizeInBytes()) << "\n";
// qDebug() << ba_message;
qDebug() << ba_message;
#endif
socket->write(ba_message);
}

0 comments on commit d2dab00

Please sign in to comment.