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. QWebSocketServer moving new connections to a own thread
QtWS25 Last Chance

QWebSocketServer moving new connections to a own thread

Scheduled Pinned Locked Moved General and Desktop
7 Posts 4 Posters 3.0k 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.
  • M Offline
    M Offline
    M4chin3
    wrote on last edited by
    #1

    Hi,

    I'm developing a client-server application. Therefore I'm using the QWebSocket class to achieve binary transparency for the sent messages. To listen for incoming connections I'm using the QWebSocketServer class which works pretty nice so far. (basically the echoclient and echoserver example)

    Now my question:
    I would like to have a thread for every incoming connection (the QTcpServer class does support this) but the documentation says the returned QWebSocket* pointer by nextPendingConnection() cannot be used from another thead. Is this somehow possible and how?

    1 Reply Last reply
    1
    • mrdebugM Offline
      mrdebugM Offline
      mrdebug
      wrote on last edited by
      #2

      @void QCNetHTTPServer::incomingConnection(int socketDescriptor) {
      QThNetHTTPServerConn *ThNetHTTPServerConn= new QThNetHTTPServerConn(this, socketDescriptor);
      ThNetHTTPServerConn->start();

      ....

      void QThNetHTTPServerConn::run() {
      QTcpSocket *QTSClient= new QTcpSocket();
      QTSClient->setSocketDescriptor(socketDescriptor);
      @

      Need programmers to hire?
      www.labcsp.com
      www.denisgottardello.it
      GMT+1
      Skype: mrdebug

      1 Reply Last reply
      0
      • M Offline
        M Offline
        M4chin3
        wrote on last edited by
        #3

        Correct for the QTcpSocket and QTcpSocketServer classes.
        But I'm asking for the QWebSocket and QWebSocketServer classes.

        QWebSocketServer does not have the method incomingConnection. So I can't overwrite it, or am I seeing this wrong?

        Any further ideas?

        1 Reply Last reply
        0
        • mrdebugM Offline
          mrdebugM Offline
          mrdebug
          wrote on last edited by
          #4

          Really I didn't know that QWebSocket existed and I don't know what QWebSocket can do.
          For my own programs that need to exchange data over network, I normally use a custom http server and client components.
          The server component uses QThread and is written on pure Qt code. I can use it for a normal http server activity and for mpeg tunnel.
          Is not so hard to write.

          What do you have to do exactly?

          Need programmers to hire?
          www.labcsp.com
          www.denisgottardello.it
          GMT+1
          Skype: mrdebug

          1 Reply Last reply
          0
          • M Offline
            M Offline
            M4chin3
            wrote on last edited by
            #5

            Websockets provide the features I need without further implementation:

            • binary transparent data transfer
            • bidirectional
            • TCP based

            HTTP is missing the bidirectional feature.
            TCP is missing the binary transparent data transfer feature.

            Therefore I want to use Websockets instead of implementing custom components to TCP sockets or HTTP transfer classes.

            1 Reply Last reply
            0
            • XandlX Offline
              XandlX Offline
              Xandl
              wrote on last edited by
              #6

              Bump for interest.
              QWebsocket actually has a private constructor where it accepts an QTcpSocket pointer - but sadly, it's private.

              JKSHJ 1 Reply Last reply
              0
              • XandlX Xandl

                Bump for interest.
                QWebsocket actually has a private constructor where it accepts an QTcpSocket pointer - but sadly, it's private.

                JKSHJ Offline
                JKSHJ Offline
                JKSH
                Moderators
                wrote on last edited by
                #7

                @Xandl said:

                Bump for interest.
                QWebsocket actually has a private constructor where it accepts an QTcpSocket pointer - but sadly, it's private.

                If you believe this is a feature that should be made public, submit a request to https://bugreports.qt.io/

                Qt Doc Search for browsers: forum.qt.io/topic/35616/web-browser-extension-for-improved-doc-searches

                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