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. How to upgrade existing HTTP socket created by QNAM to Websocket
Forum Updated to NodeBB v4.3 + New Features

How to upgrade existing HTTP socket created by QNAM to Websocket

Scheduled Pinned Locked Moved General and Desktop
4 Posts 2 Posters 845 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.
  • K Offline
    K Offline
    KaCMaHaBT
    wrote on 25 Nov 2017, 05:44 last edited by
    #1

    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?

    A 1 Reply Last reply 25 Nov 2017, 08:21
    0
    • K KaCMaHaBT
      25 Nov 2017, 05:44

      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?

      A Offline
      A Offline
      aha_1980
      Lifetime Qt Champion
      wrote on 25 Nov 2017, 08:21 last edited by
      #2

      @KaCMaHaBT Hi, Qt 5.9 introduced handleConnection exactly for this usecase.

      Qt has to stay free or it will die.

      K 1 Reply Last reply 25 Nov 2017, 08:27
      2
      • A aha_1980
        25 Nov 2017, 08:21

        @KaCMaHaBT Hi, Qt 5.9 introduced handleConnection exactly for this usecase.

        K Offline
        K Offline
        KaCMaHaBT
        wrote on 25 Nov 2017, 08:27 last edited by
        #3

        @aha_1980 Thank you!

        1 Reply Last reply
        1
        • K Offline
          K Offline
          KaCMaHaBT
          wrote on 27 Nov 2017, 08:38 last edited by
          #4

          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 Reply Last reply
          0

          1/4

          25 Nov 2017, 05:44

          • Login

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