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. QWebSocket - access bytesToWrite() to detect overload
Forum Updated to NodeBB v4.3 + New Features

QWebSocket - access bytesToWrite() to detect overload

Scheduled Pinned Locked Moved Unsolved General and Desktop
7 Posts 3 Posters 757 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
    s_b_
    wrote on last edited by
    #1

    Hi,

    I want to push lots of data over a qwebsocket connection. Unfortunately I cannot detect a network overload since there is no such thing as "bytesToWrite" as in QAbstractSocket. Is there any way to access the underlying QTcpSocket from a QWebSocket ?

    Thanks.

    JonBJ 1 Reply Last reply
    0
    • S s_b_

      Hi,

      I want to push lots of data over a qwebsocket connection. Unfortunately I cannot detect a network overload since there is no such thing as "bytesToWrite" as in QAbstractSocket. Is there any way to access the underlying QTcpSocket from a QWebSocket ?

      Thanks.

      JonBJ Offline
      JonBJ Offline
      JonB
      wrote on last edited by
      #2

      @s_b_ said in QWebSocket - access bytesToWrite() to detect overload:

      Can you leverage http://doc.qt.io/qt-5/qwebsocket.html#bytesWritten?

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

        I don't think so because I don't know the real payload that will be sent over the socket, as far as I understood the documentation bytesWritten will give me the length including all protocol and encryption overhead, not just the amount of bytes I sent initially.

        aha_1980A 1 Reply Last reply
        0
        • S s_b_

          I don't think so because I don't know the real payload that will be sent over the socket, as far as I understood the documentation bytesWritten will give me the length including all protocol and encryption overhead, not just the amount of bytes I sent initially.

          aha_1980A Offline
          aha_1980A Offline
          aha_1980
          Lifetime Qt Champion
          wrote on last edited by
          #4

          @s_b_ said in QWebSocket - access bytesToWrite() to detect overload:

          I don't think so because I don't know the real payload that will be sent over the socket, as far as I understood the documentation bytesWritten will give me the length including all protocol and encryption overhead, not just the amount of bytes I sent initially.

          But this is only the indication that the bytes are written from QWebSocket to the operating system buffers. It is no indication that the data is sent to network, and especially no indication that the data has arrived at its destination.

          Which kind of network overload do you have in mind? The network will of course not overload, it will only be filled to the max. Do you think of a receiver overload? Or do you want to preserve network capacity?

          Qt has to stay free or it will die.

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

            Basically I need to reduce the amount of data that is pushed to QWebSocket if the underlying components (Qt's ringbuffer, TCP/IP stack, receiver) are all saturated. On windows e.g. I would check if WSASend would return WSAEWOULDBLOCK / WSAENOBUFS, meaning send buffers are full, acknowledges are pending and so on...

            aha_1980A 1 Reply Last reply
            0
            • S s_b_

              Basically I need to reduce the amount of data that is pushed to QWebSocket if the underlying components (Qt's ringbuffer, TCP/IP stack, receiver) are all saturated. On windows e.g. I would check if WSASend would return WSAEWOULDBLOCK / WSAENOBUFS, meaning send buffers are full, acknowledges are pending and so on...

              aha_1980A Offline
              aha_1980A Offline
              aha_1980
              Lifetime Qt Champion
              wrote on last edited by aha_1980
              #6

              @s_b_

              Ok, if you really think that is necessary, then feel free to modify QWebSocket so you get access to QTcpPort. It would be a tailor-made solution anyway.

              [Edit] make sure your licence allows this modification, though.

              Qt has to stay free or it will die.

              S 1 Reply Last reply
              0
              • aha_1980A aha_1980

                @s_b_

                Ok, if you really think that is necessary, then feel free to modify QWebSocket so you get access to QTcpPort. It would be a tailor-made solution anyway.

                [Edit] make sure your licence allows this modification, though.

                S Offline
                S Offline
                s_b_
                wrote on last edited by
                #7

                @aha_1980 thanks for your help, I'm still in the phase of investigating what is happening on the network.

                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