Re: Socket Reading Advice
Hi,
I think that the loop that you are using is a bad idea. Thing on what happens if you call "buffer = socket->readAll()" but the socket has no data yet. A simple and best way to do this is to connect the "readyRead()" signal from the socket to a slot on you will have to check if all the data has been arrived and then close the socket connection.
Re: Socket Reading Advice
Quote:
Originally Posted by
^NyAw^
Hi,
I think that the loop that you are using is a bad idea. Thing on what happens if you call "buffer = socket->readAll()" but the socket has no data yet. A simple and best way to do this is to connect the "readyRead()" signal from the socket to a slot on you will have to check if all the data has been arrived and then close the socket connection.
Thanks, but does my blocking call to waitForReadyRead() not guarantee that when it returns with true, there will be data waiting to be read by socket->readAll()?
I would much rather take the blocking synchronous approach that using async signals/slots in this case if at all possible.
Re: Socket Reading Advice
Hi,
I said "readyRead()" signal, not "waitForReadyRead(int msecs)" method. Take a look at "fortuneclient" example.
Quote:
I would much rather take the blocking synchronous approach that using async signals/slots in this case if at all possible.
Really? Don't know why.