Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

VNC not working on any browser



  • Hi,
    I'm trying to run my QT application (or any example for that matter) as a headless VNC server using:

    -platform vnc:mode=websocket
    

    Thing is, I can successfully connect to it using standard VNC clients such as VNC Viewer and ThigthVNC but when I try to run it on my browser (http://localhost:5900) it just loads indefinitely.
    I know it should host a HTML5 client (noVNC) underneath the blankets and that is exactly what I need but whenever I try it just does not show any messages or error, it just keeps on loading.
    Anyone has any idea how to debug this problem or tell me if i'm missing anything?

    Tried it on qt 5.10 and 5.11 and a linux virtual machine and a linux notebook, both with ubuntu 14.04.
    Also tried to specify my own noVNC path with the 'viewer' flag and the result is the same always.

    Thx!


  • Banned

    This post is deleted!


  • @WernerT.A. said in VNC not working on any browser:

    I know it should host a HTML5 client (noVNC) underneath the blankets and that is exactly what I need but whenever I try it just does not show any messages or error,

    It looks like you are missing a VNC client for the browser. Could you share what you have tried so far?

    Have you checked the instructions for the noVNC client?



  • Ill list everything I've tried so far that I can remember, so for the setup I have a notebook with a native ubuntu 14.04, and another with windows 10 and Linux on a virtual machine, so:

    Running the application on Linux virtual machine:

    • Connect to http://localhost:5900 using chrome and firefox from inside the virtual machine
    • Connect to http://192.168.56.101:5900 using chrome, firefox and edge from the windows host
    • Connect to the vnc using [pigshell's vnc link](I it is think the original repo where this features was implemented): pigshell.github.io/noVNC/qtvnc.html#host=192.168.56.1014&port=5900 using firefox, edge and chrome from windows host.
    • Connect to the vnc using pigshell's vnc link using firefox, and chrome from Linux virtual machine
    • Connect to it using the noVNC client downloaded from the official website on all the above combinations.

    Running the application on Linux notebook:
    Same tests as I've done on the virtual machine

    When using my own noVNC client I get the following errors:

    For Microsoft Edge:

    SCRIPT12007: SCRIPT12007: WebSocket Error: Network Error 12007, The server name or address could not be resolved
    Msg: Server disconnected (code: 1006) 
    

    On chrome:

    WebSocket connection to 'ws://192.168.56.101:5900/websockify' failed: Error during WebSocket handshake: net::ERR_INVALID_HTTP_RESPONSE
    Msg: Server disconnected (code: 1006)
    

    Which causes my QT application to shut down and return Segmentation fault
    And firefox:

    Firefox can’t establish a connection to the server at ws://192.168.56.101:5900/websockify.
    Msg: Server disconnected (code: 1006)
    

    Also causing segmentation fault

    When I try to connect directly to the localhost and port using the built in noVNC client from inside the virtual machine I get the following:

    Chrome:

    Firefox:
    Get stuck on 'Transferring data from localhost...' for a while and the finally on the browser it shows:

    RFB 003.003
    ���
    

    It seems that this has something to do with the wrong port on the vnc server but I have no control as to what happens when I try to go directly to localhost
    and the console shows:

    The character encoding of the plain text document was not declared. The document will render with garbled text in some browser configurations if the document contains characters from outside the US-ASCII range. The character encoding of the file needs to be declared in the transfer protocol or file needs to use a byte order mark as an encoding signature.
    

    Then segmentation fault on the qt app

    Chrome:
    Just show this on the page and nothing on the console:

    This page isn’t working
    localhost sent an invalid response.
    ERR_INVALID_HTTP_RESPONSE
    

    with no segmentation fault on the app

    @Pablo-J.-Rogina said in VNC not working on any browser:

    Have you checked the instructions for the noVNC client?

    I've tried using the pure noVNC client and it says 'it does require WebSockets support' wich I belive happends when I pass the mode=websocket argument to my application if i'm not mistaken.

    I think that is about all I have.



  • @WernerT.A. said in VNC not working on any browser:

    connect to the vnc using [pigshell's vnc link](I it is think the original repo where this features was implemented): pigshell.github.io/noVNC/qtvnc.html#host=192.168.56.1014&port=5900 using firefox, edge and chrome from windows host.

    This is not going to work... you're trying for the remote server (Github) to reach your Qt app in your internal LAN (host=192.168.56.1014) even the IP in that URL is not valid.
    For this service to work, you need to forward the port (5900) of your machine running the Qt app to the external IP in your environment, and then point the service to such external IP + port



  • So I have managed to use the original noVNC client using the launch.sh script. but when I try to pass the same client as a 'viewer' option it still does not work. Thing is on the application I need, I really have to make it work with the built in server.

    @Pablo-J.-Rogina said in VNC not working on any browser:

    you're trying for the remote server (Github) to reach your Qt app in your internal LAN (host=192.168.56.1014)

    This seems exacly what Pigshell does on his example, if you look at the gif that he put in his readme. or am I mistaken?
    Using a local version of the VNC (so I should not worry about port forwarding) gives me the same problems, I have downloaded the client, and pass it's path to the 'viewer' argument as I said before, and ran the html file with the port and ip on the 3 browser and the results where exactly the same as when using the external GitHub link.

    I'm currently in contact with Danes (Pigshell) and he is being kind enough to help me ou, on his computer it worked fine, and he let a server running with a application for me to try out, when I access his link from here, the exact same errors are appearing, so to problem should be somewhere other then the application itself.


Log in to reply