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. Anyone tried to connect to the QWebsocketserver run on aws ec2 instance?
Forum Updated to NodeBB v4.3 + New Features

Anyone tried to connect to the QWebsocketserver run on aws ec2 instance?

Scheduled Pinned Locked Moved Solved General and Desktop
12 Posts 3 Posters 2.0k Views 1 Watching
  • 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.
  • thamT tham

    Qt5 version : Qt5.12.2
    aws instance : microsoft server 2019 Base, 64 bits

    *following ip address and port are fakes

    Using QWebsocket to connect to the a server written by QWebSocketServer, the server listen to QHostAddress::AnyIPV4, port:3567

    I try to connect to the server by QWebSocket as following

    socket_.open("ws://11.22.33.44:3567"), 11.22.33.44 is the public address of the aws instance.

    In order to make things easier to test, I create an inbound rule which enabled every TCP source with port 3567. But the QWebSocket always give me "QAbstractSocket.SocketError.NetworkError"

    Do I need to do some special setup in order to connect to the AWS instance by websocket?Thanks

    raven-worxR Offline
    raven-worxR Offline
    raven-worx
    Moderators
    wrote on last edited by
    #2

    @tham
    i am not sure, but doesnt AWS enforce a secure connection? so try to use wss://...
    Make sure that your AWS config allows the server to talk to the outside world.

    But the QWebSocket always give me "QAbstractSocket.SocketError.NetworkError"

    check the errorString(), it may help with more details

    --- SUPPORT REQUESTS VIA CHAT WILL BE IGNORED ---
    If you have a question please use the forum so others can benefit from the solution in the future

    1 Reply Last reply
    2
    • thamT Offline
      thamT Offline
      tham
      wrote on last edited by tham
      #3

      Thanks, using Pyside2, do QWebSocket module of Pyside2 support ssl? I cannot found the sslError signal of QWebSocket and setSslConfiguration of QWebSocketServer.

      ps : The app need to written by python, this is the requirements of the users

      Edit : I post the question of ssl in this post, almost no one visit forum of PySide2

      raven-worxR 1 Reply Last reply
      0
      • thamT tham

        Thanks, using Pyside2, do QWebSocket module of Pyside2 support ssl? I cannot found the sslError signal of QWebSocket and setSslConfiguration of QWebSocketServer.

        ps : The app need to written by python, this is the requirements of the users

        Edit : I post the question of ssl in this post, almost no one visit forum of PySide2

        raven-worxR Offline
        raven-worxR Offline
        raven-worx
        Moderators
        wrote on last edited by
        #4

        @tham said in Anyone tried to connect to the QWebsocketserver run on aws ec2 instance?:

        Thanks, using Pyside2, do QWebSocket module of Pyside2 support ssl?

        QtWebSocket does, and since its a binding i would expect so

        --- SUPPORT REQUESTS VIA CHAT WILL BE IGNORED ---
        If you have a question please use the forum so others can benefit from the solution in the future

        thamT 1 Reply Last reply
        0
        • raven-worxR raven-worx

          @tham said in Anyone tried to connect to the QWebsocketserver run on aws ec2 instance?:

          Thanks, using Pyside2, do QWebSocket module of Pyside2 support ssl?

          QtWebSocket does, and since its a binding i would expect so

          thamT Offline
          thamT Offline
          tham
          wrote on last edited by tham
          #5

          @raven-worx said in Anyone tried to connect to the QWebsocketserver run on aws ec2 instance?:

          QtWebSocket does, and since its a binding i would expect so

          But the client cannot connect to the server, always. This simple server/client example works well if written by c++

          The weird thing is the client would output error message if the server shutdown

          ssl client error code: PySide2.QtNetwork.QAbstractSocket.SocketError.RemoteHostClosedError , error msg: The remote host closed the connection

          but it never able to to connect to the server.

          Edit : found new error message after I remove the global dll of ssl. It output

          ssl client error code: PySide2.QtNetwork.QAbstractSocket.SocketError.UnsupportedSocketOperationError , error msg: SSL Sockets are not supported on this platform.
          
          

          Guess it do not support ssl on windows yet? Do anyone know these codes can work on ubuntu or not?

          raven-worxR 1 Reply Last reply
          0
          • thamT tham

            @raven-worx said in Anyone tried to connect to the QWebsocketserver run on aws ec2 instance?:

            QtWebSocket does, and since its a binding i would expect so

            But the client cannot connect to the server, always. This simple server/client example works well if written by c++

            The weird thing is the client would output error message if the server shutdown

            ssl client error code: PySide2.QtNetwork.QAbstractSocket.SocketError.RemoteHostClosedError , error msg: The remote host closed the connection

            but it never able to to connect to the server.

            Edit : found new error message after I remove the global dll of ssl. It output

            ssl client error code: PySide2.QtNetwork.QAbstractSocket.SocketError.UnsupportedSocketOperationError , error msg: SSL Sockets are not supported on this platform.
            
            

            Guess it do not support ssl on windows yet? Do anyone know these codes can work on ubuntu or not?

            raven-worxR Offline
            raven-worxR Offline
            raven-worx
            Moderators
            wrote on last edited by
            #6

            @tham said in Anyone tried to connect to the QWebsocketserver run on aws ec2 instance?:

            Edit : found new error message after I remove the global dll of ssl. It output

            isn't that an expected error when you remove the openssl libs?!?

            --- SUPPORT REQUESTS VIA CHAT WILL BE IGNORED ---
            If you have a question please use the forum so others can benefit from the solution in the future

            thamT 1 Reply Last reply
            1
            • raven-worxR raven-worx

              @tham said in Anyone tried to connect to the QWebsocketserver run on aws ec2 instance?:

              Edit : found new error message after I remove the global dll of ssl. It output

              isn't that an expected error when you remove the openssl libs?!?

              thamT Offline
              thamT Offline
              tham
              wrote on last edited by
              #7

              @raven-worx Nope, I tried it with the c++ version, if I removed the dll, the client do not has any responses.

              raven-worxR 1 Reply Last reply
              0
              • thamT tham

                @raven-worx Nope, I tried it with the c++ version, if I removed the dll, the client do not has any responses.

                raven-worxR Offline
                raven-worxR Offline
                raven-worx
                Moderators
                wrote on last edited by raven-worx
                #8

                @tham
                then your C++ application finds an appropriate OpenSSL dll from somewhere else which your Py app doesn't. Qt definitely needs OpenSSL to make SSL work (unless you compiled Qt yourself and linked OpenSSL statically).

                --- SUPPORT REQUESTS VIA CHAT WILL BE IGNORED ---
                If you have a question please use the forum so others can benefit from the solution in the future

                thamT 1 Reply Last reply
                1
                • raven-worxR raven-worx

                  @tham
                  then your C++ application finds an appropriate OpenSSL dll from somewhere else which your Py app doesn't. Qt definitely needs OpenSSL to make SSL work (unless you compiled Qt yourself and linked OpenSSL statically).

                  thamT Offline
                  thamT Offline
                  tham
                  wrote on last edited by tham
                  #9

                  @raven-worx I am using the same Qt5 version, Qt5.12.2, both of them should use the same dll. The Pyside2 is installed by pip, so it is builded by Qt company, unless they change the dll of Qt5.12.2 of pyside2 under the hood, else the same dll should work.

                  raven-worxR 1 Reply Last reply
                  0
                  • thamT tham

                    @raven-worx I am using the same Qt5 version, Qt5.12.2, both of them should use the same dll. The Pyside2 is installed by pip, so it is builded by Qt company, unless they change the dll of Qt5.12.2 of pyside2 under the hood, else the same dll should work.

                    raven-worxR Offline
                    raven-worxR Offline
                    raven-worx
                    Moderators
                    wrote on last edited by raven-worx
                    #10

                    @tham said in Anyone tried to connect to the QWebsocketserver run on aws ec2 instance?:

                    I am using the same Qt5 version, Qt5.12.2, both of them should use the same dll

                    thats not how the DLL loading works. If the application can't find them either globally or relative to the executable it wont work.

                    But easiest would to check it. E.g. use ProcessExplorer and check the loaded DLLs of your 2 applications and compare them.

                    --- SUPPORT REQUESTS VIA CHAT WILL BE IGNORED ---
                    If you have a question please use the forum so others can benefit from the solution in the future

                    thamT 2 Replies Last reply
                    0
                    • raven-worxR raven-worx

                      @tham said in Anyone tried to connect to the QWebsocketserver run on aws ec2 instance?:

                      I am using the same Qt5 version, Qt5.12.2, both of them should use the same dll

                      thats not how the DLL loading works. If the application can't find them either globally or relative to the executable it wont work.

                      But easiest would to check it. E.g. use ProcessExplorer and check the loaded DLLs of your 2 applications and compare them.

                      thamT Offline
                      thamT Offline
                      tham
                      wrote on last edited by tham
                      #11

                      @raven-worx Thanks, will check, however I think they load the same dll(c++ and pyside2), because the behaviors are different after/before I remove the dll, maybe a bug of pyside2.

                      1 Reply Last reply
                      0
                      • raven-worxR raven-worx

                        @tham said in Anyone tried to connect to the QWebsocketserver run on aws ec2 instance?:

                        I am using the same Qt5 version, Qt5.12.2, both of them should use the same dll

                        thats not how the DLL loading works. If the application can't find them either globally or relative to the executable it wont work.

                        But easiest would to check it. E.g. use ProcessExplorer and check the loaded DLLs of your 2 applications and compare them.

                        thamT Offline
                        thamT Offline
                        tham
                        wrote on last edited by tham
                        #12

                        @raven-worx Comfirm it with ProcessExplorer, I am sure c++ and pyside2 load the same ssl dll if I put the ssl dll into PATH.

                        Edit : Should I open a bug report on JIRA?

                        Edit2 : This seems like a known issue--Missing ssl support for QWebSocketServer and QWebSocket

                        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