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. [SOLVED]setting QTcpSocket TCP_NODELAY option
QtWS25 Last Chance

[SOLVED]setting QTcpSocket TCP_NODELAY option

Scheduled Pinned Locked Moved General and Desktop
5 Posts 2 Posters 8.4k Views
  • 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.
  • S Offline
    S Offline
    swhweng
    wrote on last edited by
    #1

    Hello.

    In order to assure understanding and correctness:

    I need to set TCP_NODELAY option to QTcpSocket, I found in documentation next function of QAbstractSocket class can be used for that:
    @
    void setSocketOption ( QAbstractSocket::SocketOption option, const QVariant & value )@

    enum QAbstractSocket::SocketOption

    QAbstractSocket::LowDelayOption = 0

    should be used.

    I can't find in the documentation description of value - second function parameter meaning ?
    I do not understand what to put to second parameter value ?
    How can I set that option , whether by next call:
    ....setSocketOption(0);?

    Thanks in advance.

    1 Reply Last reply
    0
    • D Offline
      D Offline
      dangelog
      wrote on last edited by
      #2

      The docs say you should pass the integer "1". Why don't you do that?

      Software Engineer
      KDAB (UK) Ltd., a KDAB Group company

      1 Reply Last reply
      0
      • S Offline
        S Offline
        swhweng
        wrote on last edited by
        #3

        sorry whether setSocketOption(0); should be called ?
        ( I've edited the previous post ).

        bq. The docs say you should pass the integer “1”. Why don’t you do that?

        Why 1 ? Where is it in docs ?

        do you mean next call :

        ....setSocketOption(QAbstractSocket::LowDelayOption,1); ?

        Thanks.

        1 Reply Last reply
        0
        • D Offline
          D Offline
          dangelog
          wrote on last edited by
          #4

          [quote]Try to optimize the socket for low latency. For a QTcpSocket this would set the TCP_NODELAY option and disable Nagle's algorithm. Set this to 1 to enable.[/quote]

          http://doc.qt.nokia.com/4.8/qabstractsocket.html#SocketOption-enum

          Software Engineer
          KDAB (UK) Ltd., a KDAB Group company

          1 Reply Last reply
          0
          • S Offline
            S Offline
            swhweng
            wrote on last edited by
            #5

            Thanks. Solved.

            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