Does anybody have experience with QDataStream reading from QProcess or
QFile.open(stdin,QIODevice::ReadOnly )? At the beginning I naively
thought that it just works cross platform. Looking closer, it does not
seem so obvious, see also [1][2]. What I am observing (currently on
Linux) is that if there are no data on the device, reading from
QDataStream is not blocked until data are available, it sets an error
and continues. In theory, the underlying QIODevice::readData should
block, Qt doc states:

"When reimplementing this function it is important that this function
reads all the required data before returning. This is required in
order for QDataStream to be able to operate on the class. QDataStream
assumes all the requested information was read and therefore does not
retry reading if there was a problem."

I looked briefly into QProcess code and it seems to be blocking,
unfortunately in practice it is not. Am I missing some options, mode
settings? Do I have to write my blocking QIODevice subclasses?

Radim


[1] 
http://stackoverflow.com/questions/19681564/read-from-qtcpsocket-using-qdatastream
[2] http://lists.qt-project.org/pipermail/interest/2012-May/002110.html
_______________________________________________
Qgis-developer mailing list
Qgis-developer@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/qgis-developer

Reply via email to