[Interest] Odd behavior with QTcpSocket::waitForReadyRead()

Thiago Macieira thiago.macieira at intel.com
Wed Dec 21 15:14:36 CET 2016


Em segunda-feira, 19 de dezembro de 2016, às 16:38:30 BRST, Bob Hood escreveu:
>          int msecs = timeout * 1000000;
>          if(!socket.waitForReadyRead(msecs))
>          {
>              QString msg = QString(tr("An error occurred while receiving
> data from the server: \"%1\"
> (%2).")).arg(socket.errorString()).arg(socket.error()); ...
> 
> This causes the communications to fail, even though the action takes place
> pretty much instantly, because I'm running the server on the same machine
> for testing/debugging.  If I tell QTcpSocket::waitForReadyRead() to wait
> forever:
> 
>          if(!socket.waitForReadyRead(-1))
> 
> everything runs smoothly.

The problem is most likely in the part of the program that you didn't paste.

-- 
Thiago Macieira - thiago.macieira (AT) intel.com
  Software Architect - Intel Open Source Technology Center




More information about the Interest mailing list