C++ (Qt)...const int Timeout = 5 * 1000;pSocket->waitForBytesWritten(Timeout);QApplication::processEvents();...