Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problem with novnc-websockify on Windows #67

Closed
doriwal opened this issue Feb 17, 2013 · 26 comments · Fixed by #388
Closed

Problem with novnc-websockify on Windows #67

doriwal opened this issue Feb 17, 2013 · 26 comments · Fixed by #388
Labels
bug Something isn't working patchwelcome Windows

Comments

@doriwal
Copy link

doriwal commented Feb 17, 2013

1- I download the https://github.com/downloads/kanaka/websockify/Websockify%20Windows%20Service.zip

2- i unzip the folder at C:\Websockify Windows Service

3- i download https://github.com/downloads/kanaka/websockify/websockify.zip

and unzip and copy its content to C:\Websockify Windows Service

4- i download novnc from https://github.com/kanaka/noVNC

5- i unzip it at C:\Users\waldman\Downloads\noVNC-master\noVNC-master

6- i run the command

C:\Websockify Windows Service>websockify.exe --web "C:\Users\waldman\Downloads\noVNC-master\noVNC-master" 6080 localhost
:5901

the log is :

WARNING: no 'resource' module, daemonizing support disabled
WebSocket server settings:

  • Listen on :6080
  • Flash security policy server
  • Web server. Web root: C:\Users\waldman\Downloads\noVNC-master\noVNC-master
  • No SSL/TLS support (no cert file)
  • proxying from :6080 to localhost:5901

In my browser i am going to

http://localhost:6080/vnc_auto.html?host=localhost&port=6080&true_color=1

also tried with

http://localhost:6080/vnc_auto.html?host=localhost&port=5901&true_color=1

I am getting server disconnected --> WHY ? ? ?

The server is fine as when i am trying to use

http://kanaka.github.com/noVNC/noVNC/vnc_auto.html?host=localhost&port=5901&true_color=1

I can login to my server with no problem

So my question is What is missing in order that i will be able to use my novnc service and not to use the "http://kanaka.github.com/noVNC/noVNC/vnc_auto.html"

I want to have my nonvc and not use external "kanaka.github.com"

Thanks for help

B.T.W same issue happened both at windows & linux (I prefer windows solution)

the log is

2: 127.0.0.1: ignoring socket not ready
3: 127.0.0.1: ignoring empty handshake
4: 127.0.0.1: "GET /auto.vnc.html?host=localhost&port=6080&true_color=1 HTTP/1.1" 404 -
5: 127.0.0.1: ignoring socket not ready
6: 127.0.0.1: "GET /auto-vnc.html?host=localhost&port=6080&true_color=1 HTTP/1.1" 404 -
9: 127.0.0.1: ignoring socket not ready
10: 127.0.0.1: ignoring empty handshake
12: 127.0.0.1: ignoring socket not ready
13: 127.0.0.1: ignoring empty handshake
14: 127.0.0.1: ignoring empty handshake
15: 127.0.0.1: ignoring empty handshake
16: 127.0.0.1: ignoring empty handshake
17: 127.0.0.1: ignoring empty handshake
18: 127.0.0.1: ignoring empty handshake
19: 127.0.0.1: ignoring empty handshake
20: 127.0.0.1: ignoring empty handshake
21: 127.0.0.1: ignoring empty handshake
22: 127.0.0.1: ignoring empty handshake
23: 127.0.0.1: ignoring empty handshake
24: 127.0.0.1: ignoring empty handshake
25: 127.0.0.1: ignoring empty handshake
26: 127.0.0.1: ignoring empty handshake
27: 127.0.0.1: ignoring empty handshake
28: 127.0.0.1: ignoring empty handshake
29: 127.0.0.1: ignoring empty handshake
30: 127.0.0.1: ignoring empty handshake
31: 127.0.0.1: ignoring empty handshake
33: 127.0.0.1: ignoring socket not ready
34: 127.0.0.1: ignoring empty handshake
35: 127.0.0.1: ignoring empty handshake
36: 127.0.0.1: ignoring empty handshake

@doriwal doriwal closed this as completed Feb 17, 2013
@kanaka
Copy link
Member

kanaka commented Feb 17, 2013

@doriwal I notice you closed the issue. Does that mean you figured it out?

@doriwal
Copy link
Author

doriwal commented Feb 18, 2013

No its an open issue
On 2013 2 18 00:34, "Joel Martin" notifications@github.com wrote:

@doriwal https://github.com/doriwal I notice you closed the issue. Does
that mean you figured it out?


Reply to this email directly or view it on GitHubhttps://github.com//issues/67#issuecomment-13698686.

@doriwal doriwal reopened this Feb 18, 2013
@doriwal
Copy link
Author

doriwal commented Feb 18, 2013

I reopened the issue as it wasnt solved

@doriwal
Copy link
Author

doriwal commented Feb 18, 2013

looks like my local novnc is working ,
I just run the tests like http://localhost:6080/tests/base64.html

and the response is

onload
PASS: 'window.btoa("hello world")' returned expected 'aGVsbG8gd29ybGQ='
PASS: 'window.btoa("a")' returned expected 'YQ=='
PASS: 'window.btoa("ab")' returned expected 'YWI='
PASS: 'window.btoa("abc")' returned expected 'YWJj'
PASS: 'window.btoa("abcd")' returned expected 'YWJjZA=='
PASS: 'window.btoa("abcde")' returned expected 'YWJjZGU='
PASS: 'window.btoa("abcdef")' returned expected 'YWJjZGVm'
PASS: 'window.btoa("abcdefg")' returned expected 'YWJjZGVmZw=='
PASS: 'window.btoa("abcdefgh")' returned expected 'YWJjZGVmZ2g='
PASS: 'window.atob("aGVsbG8gd29ybGQ=")' returned expected 'hello world'
PASS: 'Base64_decode("aGVsbG8gd29ybGQ=")' returned expected 'hello world'
PASS: 'window.atob("YQ==")' returned expected 'a'
PASS: 'Base64_decode("YQ==")' returned expected 'a'
PASS: 'window.atob("YWI=")' returned expected 'ab'
PASS: 'Base64_decode("YWI=")' returned expected 'ab'
PASS: 'window.atob("YWJj")' returned expected 'abc'
PASS: 'Base64_decode("YWJj")' returned expected 'abc'
PASS: 'window.atob("YWJjZA==")' returned expected 'abcd'
PASS: 'Base64_decode("YWJjZA==")' returned expected 'abcd'
PASS: 'window.atob("YWJjZGU=")' returned expected 'abcde'
PASS: 'Base64_decode("YWJjZGU=")' returned expected 'abcde'
PASS: 'window.atob("YWJjZGVm")' returned expected 'abcdef'
PASS: 'Base64_decode("YWJjZGVm")' returned expected 'abcdef'
PASS: 'typeof window.btoa' returned expected 'function'
PASS: 'window.btoa("")' returned expected ''
PASS: 'window.btoa(null)' returned expected ''
PASS: 'window.atob(window.btoa(window))' returned expected '[object Window]'
PASS: 'window.btoa("\u0080\u0081")' returned expected 'gIE='
Tests failed: 0
Tests passed: 28

So I guess that i did installed novnc locally ,

I dont know why
http://localhost:6080/vnc_auto.html?host=localhost&port=5901&true_color=1
or
http://localhost:6080/vnc_auto.html?host=localhost&port=6080&true_color=1

returned "noVNC ready: native WebSockets, canvas rendering" and after 2 seconds i get "Connect timeout"

@smithkl42
Copy link

I was having the same issue with the websockify.exe that came with noVNC.

I'm not sure if it's the same problem, but when I tried to run the websocketproxy.py file directly with Python 2.7, I get this error:

WARNING: no 'resource' module, daemonizing is slower or disabled
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "C:\Python27\lib\multiprocessing\forking.py", line 374, in main
    self = load(from_parent)
  File "C:\Python27\lib\pickle.py", line 1378, in load
    return Unpickler(file).load()
  File "C:\Python27\lib\pickle.py", line 858, in load
    dispatch[key](self)
  File "C:\Python27\lib\pickle.py", line 1133, in load_reduce
    value = func(*args)
  File "C:\Python27\lib\multiprocessing\reduction.py", line 193, in rebuild_socket
    _sock = fromfd(fd, family, type_, proto)
  File "C:\Python27\lib\multiprocessing\reduction.py", line 182, in fromfd
    s = socket.fromfd(fd, family, type_, proto)
AttributeError: 'module' object has no attribute 'fromfd'

Apparently that's because socket.fromfd isn't implemented on Python 2.x for Windows: http://bugs.python.org/issue1378.

When I try to run websockify with Python 3.3, I get a different error message:

  1: handler exception: Cannot serialize socket object
WARNING: no 'resource' module, daemonizing is slower or disabled
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "C:\Python33\lib\multiprocessing\forking.py", line 344, in main
    self = load(from_parent)
EOFError

@DirectXMan12
Copy link
Member

@doriwal , @smithkl42 : are you still experiencing this issue?

@smithkl42
Copy link

I was able to get websockify running on Windows if I used Python 3.2. Neither 2.7 nor 3.3 seem to have the necessary support for pseudo-forking processes on Windows. I haven't tried it with any other versions.

@DirectXMan12
Copy link
Member

@smithkl42 : it would appear that Python pickles and then unpickles the Process in order to do a fork, and something in websockify isn't pickleable. It's strange, though, that it works on 3.2 and not 3.3. Can you get a more extended stack trace for Python 3.3? I think it's at least worth trying to fix the issue for Python 3.3+ if we can.

@smithkl42
Copy link

I agree that it'd be worth fixing. I'm not a Python coder, so I'm not sure how to get a more detailed stack trace - that's just what shows up on my console when I try to run it under Python 3.3. Any suggestions?

@DirectXMan12 DirectXMan12 reopened this Nov 4, 2013
@DirectXMan12
Copy link
Member

Whoops, didn't mean to close this. Must have clicked the wrong button.
Bah! Python 3.3 just out and out refuses to serialize sockets:
from /usr/lib64/python3.3/socket.py:

    def __getstate__(self):
        raise TypeError("Cannot serialize socket object")

While Python 3.2 doesn't specify a __getstate__ method at all. Were you able to confirm that things actually worked properly under Python 3.2? I can't see the Python devs arbitrarily disabling pickling of sockets in Python 3.3 unless there was actually something wrong with the way things worked in 3.2...

@smithkl42
Copy link

Yeah, 3.2 is working fine for me. I haven't tested it under load, but under the limited load I've thrown at it, it's been working just fine. Whatever serialization problems there might be, I suspect they must be of the sort that (for whatever reason) aren't affecting websockify.

@kabilraj1979
Copy link

kabilraj1979 commented Jun 2, 2017

@kanaka : I am trying to run the websockify on Windows 2012 R2 Standard (64 bit).
I have installed Python 2.7.11 version.
Installed compatible 64 bit versions of "py2exe" and "numpy".
Went through all of the issues mentioned for running novnc on Windows (especially #108 and #233)

Issue : When I try to connect via the web url (http://localhost/vnc.html?host=localhost&port=6080), I am getting handler exception : "can't pickle thread.lock objects"
"Import error: No module named run" from the forking.py

Please suggest a resolution. I get a feeling that there has not been robust successful running experience of this tool in Windows. Please let me know if it is not intended to run on Windows. Or am I missing something from my side? Appreciate your response

image

@kanaka
Copy link
Member

kanaka commented Jun 2, 2017

@kabilraj1979 websockify does not work on Windows using python 2.X. There has been some success using python 3.X. However, the node.js version of websockify apparently (I don't have a Windows system to test with) works pretty well on Windows so I suggest you use the node.js version if it that is an option for you.

@kabilraj1979
Copy link

@kanaka : Thanks for the response. The websockify.js allowed me to connect. Thanks. Need to explore what code is there in the web content. The js file was more or less doing the send and receive part of the web socket connection (kind of a reverse proxy)?

@sonicnkt
Copy link

sonicnkt commented Jun 7, 2017

Is there a way to build the nodejs version in a simple script/exe version that is easy to deploy?
I saw the Powershell script here: https://github.com/aberbegall/novnc-launch-powershell/blob/master/README.md
But it has a lot of dependencies (installing full nodejs, then download additional packages etc), so there is no way to easily deploy this for me on multiple clients.
My goal was to put together a free, open and independent remote solution that wont rely on any additional servers.

@kabilraj1979
Copy link

@kanaka: Every time I have to proxy to a VNC server, I need to have different instances of the websockify.js. Is there a way to run it as a listener that can allow multiple connections on the fly? WebSocketConnections can be opened from one instance of the websockify.js on the fly right?

@kanaka
Copy link
Member

kanaka commented Jun 14, 2017

@kabilraj1979 multiple clients can connect to the same instance of websockify.js at the same time. However, you need to have one instance of websockify.js per target that you want to connect to. The python version of websockify supports target plugins which allow the target to be selected by an opaque token provided by the client. However, this functionality has not been ported to the websockify.js yet.

@CendioOssman
Copy link
Member

I tested the SIGCHLD thing, but as you've noticed there are a lot of issues remaining with multiprocessing. For now I've put an active block in the code so it refuses to start on Windows. Should make our handling of issues a bit smoother at least.

@gdan101
Copy link

gdan101 commented Jan 2, 2018

@sonicnkt: I managed to create an exe (from the Node.js version) so you don't need to install Node.js and the components.
These are the steps (I never used Node.js before, so I am pretty sure there is a shorter solution):

  1. Install NodeJS (the default global installation path is: %AppData%\npm, %AppData%\npm-cache)

  2. Install required components, run:

    • npm install -g express
    • npm install -g optimist
    • npm install -g policyfile
    • npm install -g ws
    • npm install -g http-server
    • npm install -g mime-types
    • npm install -g pkg
  3. Create a folder named "websockify" under "%AppData%\npm\node_modules" and copy the contents of folder "websockify\other\js" in it.

  4. Run (documentation of arguments -> https://www.npmjs.com/package/pkg): pkg "%AppData%\npm\node_modules\websockify\websockify.js" --targets "latest-win-x86,latest-win-x64" --out-path "your output folder"

@samhed
Copy link
Member

samhed commented Jan 3, 2018

That works well for me too. Tested on Windows 10 and with noVNC + TigerVNC Windows server.

@mliudev
Copy link

mliudev commented May 22, 2018

@gdan101 Could you tell me what version of node you had when you got this to run? I'm running into an issue with nodejs 10.1.0 and websockify: https://github.com/novnc/websockify/issues/307#issuecomment-391125660

@gdan101
Copy link

gdan101 commented May 23, 2018

@mliudev I had node-v6.11.4 on a Windows 7 x64 machine!

@SiddharthJyoti
Copy link

SiddharthJyoti commented May 20, 2019

@kanaka @CendioOssman Does NOVNC support Reverse VNC connection the way it is supported by tightvnc.
Reference: https://kempniu.wordpress.com/2009/03/21/reverse-connections-in-tightvnc/

How can we open novnc viewer in listening mode if answer is yes for above question.

We are using novnc to capture devices inside network however we want to use same web application for capturing(vnc) devices outside the network over the internet. This is because web server can not reach devices with private ip behind the router. We would like to use reverse vnc feature that should allow devices with private ip to share screen to novnc client on web server

@samhed
Copy link
Member

samhed commented May 21, 2019

@SiddharthJyoti Please stop spamming the same question in mutliple places

@SiddharthJyoti
Copy link

SiddharthJyoti commented May 21, 2019

@samhed Your prompt response on the question will be appreciated.

@samhed
Copy link
Member

samhed commented May 21, 2019

noVNC does not support reverse connections like the one described in that blog.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working patchwelcome Windows
Projects
None yet
Development

Successfully merging a pull request may close this issue.