void myClient::readyRead()
{
//qDebug() << socket->readAll();
QFile sentFile
(fPath
+QDir::separator() + fName
);
if(!sentFile.exists())
{
sentFile.
open(QFile::WriteOnly);
//check if size equal to size or overwrite while(socket->waitForReadyRead())
{
qDebug()<< "read: " << block.size();
sentFile.write(block);
block.clear();
}
socket->close();
sentFile.close();
}
}
void myClient::readyRead()
{
//qDebug() << socket->readAll();
QString fPath("location");
QByteArray block=socket->readAll();
QString fName= QString(block);
QFile sentFile(fPath +QDir::separator() + fName);
if(!sentFile.exists())
{
sentFile.open(QFile::WriteOnly);//check if size equal to size or overwrite
while(socket->waitForReadyRead())
{
QByteArray block= socket->readAll();
qDebug()<< "read: " << block.size();
sentFile.write(block);
block.clear();
}
socket->close();
sentFile.close();
}
}
To copy to clipboard, switch view to plain text mode
i guess the while loop is blocking my GUI
how can l make this code non-Blocking
Thanks and best regards.
Bookmarks