Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
pmaynard last edited by
What's the fastest transfer - stick with the QTcpSocket read() and write() or use the QDataStream readRawData() and writeRawData() (with QTcpSocket)? I need to transfer images over the wire so I'm looking for the minimum amount of re-formatting, buffering, etc. I would guess the low level read() and write() would be fastest, but ...
When using native tcp/ip on the same machine, calls drop down to pipes (much faster). When using Qt* socket calls, is there anything I can do / set that gets the max bandwidth?
AxDSan last edited by
Hmmm Don't know whats the matter, The data encapsulation with RAW packets looks kinda off the same (for me) I think personally that I would go best with normal QTcpSocket Read() & Write() functions as they are more "Straight forward" just to say... As the low level stuff QTcpSocket is actually low level by default so you wouldn't have any problems at all with the image transfers if that's what you want... I think this is all just personal thing to say...
Lets see if others have their points of view..
lgeyer last edited by
QTcpSocket will always buffer your data for asynchronous transfer. You can set the amount of data buffered while reading using "QAbstractSocket::setReadBufferSize()":http://doc.qt.digia.com/qt/qabstractsocket.html#setReadBufferSize.
Technically QTcpSocket has one abstraction layer less than QDataStream, so it may provide better performance. However, I seriously doubt that there is any difference in pratice, because usually the network bandwidth will be the limiting factor, not the processing power.
So go for the most convenient solution, regardless wheter you use QDataStream, QTcpSocket or low level read() and write(), as you will almost always provide data at a higher rate your network can handle.