Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. QTcpSocket bandwidth
Forum Updated to NodeBB v4.3 + New Features

QTcpSocket bandwidth

Scheduled Pinned Locked Moved General and Desktop
3 Posts 3 Posters 2.9k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • P Offline
    P Offline
    pmaynard
    wrote on last edited by
    #1

    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?

    1 Reply Last reply
    0
    • A Offline
      A Offline
      AxDSan
      wrote on last edited by
      #2

      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..

      1 Reply Last reply
      0
      • L Offline
        L Offline
        lgeyer
        wrote on last edited by
        #3

        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.

        1 Reply Last reply
        0

        • Login

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • Users
        • Groups
        • Search
        • Get Qt Extensions
        • Unsolved