[Interest] readyRead() signal issues with QTcpSopcket and Qt 5.6 under minGW

Etienne Sandré-Chardonnal etienne.sandre at m4x.org
Mon Jul 11 15:47:17 CEST 2016


Hi Thiago,

After further investigation, the issue is not related to TCP but to
threads/events. It's on client (ie sender) side.

I have the following order of events :

Client * client = new Client(host, this);
QThread * clientThread = new QThread(this);
client->moveToThread(clientThread);
connect(this, SIGNAL(sendClientCommand(QString)), client, SLOT(command(
QString)));
connect(client, SIGNAL(messageSent(QString)), this, SLOT
(messageFromClient(QString)));
QTimer::singleShot(0, clientThread , SLOT(start()));      //Differed start
required to avoid missing messages
emit sendClientCommand("loadstart");



So I have a signal connected to an object's slot in another thread. I emit
the signal before the thread is started. I do not know if this is correct,
but :

   - With Qt 5.4 the command("loadstart") slot is properly called as soon
   as possible
   - With Qt 5.6 the slot is not called until I emit the signal again, as
   if the event was queued, but the queue not processed until another event is
   sent.

Also, if I add a Client::threadStarted() slot calling processEvents() and
connect it to QThread::started() slot of clientThread, then the command
slot is processed on time. I do not know if this is an effect of
processEvents() or if this is because the connection is also queued, thus
waking up the event loop.
Can this be a Qt bug or am I misusing the queued connection?

Thanks





2016-07-09 21:01 GMT+02:00 Thiago Macieira <thiago.macieira at intel.com>:

> On sábado, 9 de julho de 2016 15:19:23 PDT Etienne Sandré-Chardonnal wrote:
> > After additional tests, bytesAvailable() is not growing either.
> >
> > So on the sender, the packet has been sent, and the QTcpSocket flushed,
> > On the receiver, I have no readyRead signal(), and bytesAvailable() is
> zero.
>
> The first rule of checking networking problems is isolating the problem to
> either the sender or the receiver.
>
> Please use a packet sniffer and tell us whether the problem is:
>  a) packet was never sent from the sender machine
>  b) packet was sent from the sender but the receiver didn't ACK it
>  c) packet was sent and ACK'ed, but the application didn't receive it
>
> --
> Thiago Macieira - thiago.macieira (AT) intel.com
>   Software Architect - Intel Open Source Technology Center
>
> _______________________________________________
> Interest mailing list
> Interest at qt-project.org
> http://lists.qt-project.org/mailman/listinfo/interest
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20160711/42e4d5f8/attachment.html>


More information about the Interest mailing list