How to upgrade existing HTTP socket created by QNAM to Websocket
-
wrote on 25 Nov 2017, 05:44 last edited by
Hi,
I doing a HTTP request via QNetworkAccessManager. I set a 'Keep-Alive' option, and hope a socket will not be closed. Next I create QWebSocket to the same address and port.
Problem is the QWebSocket uses a new source port, but I want to reuse old one, the port from the QNAM.How I can reuse the old source port in QWebSocket?
-
Hi,
I doing a HTTP request via QNetworkAccessManager. I set a 'Keep-Alive' option, and hope a socket will not be closed. Next I create QWebSocket to the same address and port.
Problem is the QWebSocket uses a new source port, but I want to reuse old one, the port from the QNAM.How I can reuse the old source port in QWebSocket?
@KaCMaHaBT Hi, Qt 5.9 introduced handleConnection exactly for this usecase.
-
@KaCMaHaBT Hi, Qt 5.9 introduced handleConnection exactly for this usecase.
-
wrote on 27 Nov 2017, 08:38 last edited by
Hi.
I thanked too early :)
First of all -- this is websocketserver, but I trying to make a websocket client, like a browser.
Second thing -- we don't have an access to the socket in QNAM and cannot create a custom socket for connection like in early versions of Qt. QHTTP and theirs method setSocket are marked as deprecated.
So, the problem still the actual
1/4