-
-
Save oppahero/c54cf555488392df7674e9a644415718 to your computer and use it in GitHub Desktop.
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
void Server::sendTextToOne(QString text,ClientThread* target){ | |
QByteArray block; | |
QDataStream out(&block,QIODevice::WriteOnly); | |
out.setVersion(QDataStream::Qt_5_8); | |
out << (quint32)0 << text; | |
out.device()->seek(0); | |
out << (quint32)(block.size() - sizeof(quint32)); | |
qDebug() << "block.size() = " << block.size(); | |
qint64 x = 0; | |
while(x < block.size()){ | |
qint64 y = target->getTcpSocket()->write(block); | |
x+=y; | |
qDebug() << target->getUsername()<< " /sent " << x ; | |
qDebug() << "-----"; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment