QWebSocket - access bytesToWrite() to detect overload
-
wrote on 5 Jun 2018, 08:40 last edited by
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.
-
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.
wrote on 5 Jun 2018, 08:59 last edited by@s_b_ said in QWebSocket - access bytesToWrite() to detect overload:
Can you leverage http://doc.qt.io/qt-5/qwebsocket.html#bytesWritten?
-
wrote on 5 Jun 2018, 09:04 last edited by
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.
-
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.
@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?
-
wrote on 5 Jun 2018, 09:46 last edited by s_b_ 6 May 2018, 09:49
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...
-
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...
Lifetime Qt Championwrote on 5 Jun 2018, 09:52 last edited by aha_1980 6 May 2018, 09:56Ok, 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.
-
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.
1/7