A brief introduction to how the QT signal is connected to the slot:
Qt::autoconnection means that the system automatically chooses the appropriate connection mode, if the signal and slot on the same thread, the use of QT::D irectconnection,
If the signal is not on the same thread as the slot, the Qt::queuedconnection connection will be used.
Qt::D irectconnection indicates that the slot function is executed immediately once the signal is generated.
Qt::queuedconnection indicates that after the signal is generated, the event will be sent to the thread where your receiver is located, postevent (Qevent::metacall,...),
The slot function is processed in the event loop of the thread where receiver is located.
Qt::blockingqueuedconnection indicates that the signal is generated after calling Sendevent (Qevent::metacall,...),
The receiver is not returned until the thread processing is complete, only if the sender,receiver is not on the same thread.
Qt::uniqueconnection indicates that the connection will succeed only if it is not a duplicate connection. If you have previously had a link (the same signal is connected to the same slot on the same object), the connection will fail and will return false.
Qt::autocompatconnection and QT3 Maintain compatibility
Note that for any qthread, its thread exists only in the run () function, and the other functions are not in the thread, so qt::blockingqueuedconnection is used here.
Because the Readyread () signal is emitted when the socket has data arrives, but at this point it is possible that the previous receivefile () is not finished, the qt::autoconnection used previously,
The result is that when a large file is transmitted, the error occurs because the signal is connected as soon as the data arrives, but the data reception is not processed, and the qt::blockingqueuedconnection blocks
This connection is not sent until Receivefile () has finished processing and returns.
Qdebug () << "Run Thread:" <<qthread::currentthreadid ();
Connect (tcpsocket,signal (Readyread ()), This,signal (RECEIVESGL (Tcpsocket)));
Connect (tcpsocket,signal (Readyread ()), This,slot (Receivefile ()), qt::blockingqueuedconnection);
exec ();
}
QT multi-threaded signal slot transmission mode