novnc / websockify

Websockify is a WebSocket to TCP proxy/bridge. This allows a browser to connect to any application/server/service.
GNU Lesser General Public License v3.0
3.95k stars 780 forks source link

win32 support #2

Closed kanaka closed 4 years ago

kanaka commented 13 years ago

Add support for win32.

One of the main changes will require using the multiprocessing module rather than os.fork().

eph214 commented 12 years ago

with that change to increasing the timeout, i get this response now :

10: handler exception: file descriptor cannot be a negative integer (-1)

when i telnet to localhost on 8080 while running C:\noVNC\utils>c:\python32\python.exe websockify :8080 127.0.0.1:5900 in a different cmd window

and it closes the connection again after a few seconds.

eph214 commented 12 years ago

If it's working for someone else, can you please post the exact version of novnc and the exact version of python you are running? I'm testing with

kanaka-noVNC-v0.1-64-g2fa565b and python-3.2.2 (windows installer)

i'm running windows xp sp3 in a virtualbox vm.

vicky555 commented 12 years ago

Hey eph214, i guess i faced the same problem before, i am using python 2.7 with patched version of websockify as i described above. Its working fine for me.

agnivade commented 12 years ago

Hi @vicky555 , I am also using Windows 7 with python 2.7. Trying very hard to get this work. I read the thread about differences between python 2.7 and 3.1, I incorporated the changes for the import multiprocessing.reduction and also the Process call in start_server() function. But still I am getting the same error

PS E:\Misc projects\noVNC> python .\utils\websockify.py --web ./ 8787 localhost:5901 --cert .\utils\self.pem WARNING: no 'numpy' module, HyBi protocol is slower or disabled WARNING: no 'resource' module, daemonizing is slower or disabled WebSocket server settings:

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

Actually I am too confused as to exactly what changes to do in my files to get it running for python 2.7. Can you help me out in this regard ? It would be very helpful if you could show me the modified websocket.py and websockify.py.

vicky555 commented 12 years ago

@agnivade i am using following files which you have mentioned.. please download both files from http://www.fileswap.com/dl/EYj3rk4zof/ http://www.fileswap.com/dl/pyr0BppSJA/

agnivade commented 12 years ago

@vicky555 many thanks. Its working now.

vicky555 commented 12 years ago

@agnivade you are welcome.. :)

pushakargaikwad commented 11 years ago

@vicky555 can u please share those files again. the links seem to be broken now. thanks in advance :)

vicky555 commented 11 years ago

@pushakargaikwad please download files from following ur http://s000.tinyupload.com/?file_id=91614758356692933726 http://s000.tinyupload.com/?file_id=02238768050340581102 Thanks

drussilla commented 11 years ago

To fix " Traceback (most recent call last): File "", line 1, in File "c:\python32\lib\multiprocessing\forking.py", line 369, in main prepare(preparation_data) File "c:\python32\lib\multiprocessing\forking.py", line 486, in prepare file, path_name, etc = imp.find_module(main_name, dirs) ImportError: No module named websockify " Just copy websockify to websockify.py (with replacing). Detailed instruction you can look here: http://druss.pp.ua/2013/10/run-novnc-websockify-on-windows-server-disconnected-code-1006-fixed/

groupboard commented 10 years ago

Has anyone managed to get it working on Windows? I've tried on Vista and Win7 with python 3.4 and portable python, but I always get this error:

ImportError: No module named 'websocket'.

Any suggestions? It works fine on linux.

vedmack commented 10 years ago

Same problem here, after compiling websockify as windows executable I can't manage to use it without getting errors (I'm not even sure that the compiled (using portable python 2.7 version will support multiple client connection at a time)) , I also posted a Q' on stackoverflow , Help will be appreciated...

groupboard commented 10 years ago

The solution is to use the Node.js version on Windows, instead of the php version. It works like a charm, out of the box.

vedmack commented 10 years ago

Did anyone managed to run websockify (python) on windows with multiprocessing support (with the ability to connect more than one client to the server through the same websockify instance), if so, please tell me how, Thanks! (can't use Node.js version)

vicky555 commented 10 years ago

@vedmack follow this issue.. your problem will be solved

https://github.com/kanaka/websockify/issues/3

kobemajian commented 10 years ago

C:\Users\majian-xy>python E:\noVNC\utils\websockify 7777 10.18.27.57:5900

WARNING: no 'numpy' module, HyBi protocol will be slower WARNING: no 'resource' module, daemonizing is disabled WebSocket server settings:

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "E:\noVNC\utils\websockify", line 471, in websockify_init() File "E:\noVNC\utils\websockify", line 419, in websockify_init server.start_server() File "E:\noVNC\utils\websocket.py", line 1017, in start_server self.msg("handler exception: %s", str(exc)) UnboundLocalError: local variable 'exc' referenced before assignment

C:\Users\majian-xy>WARNING: no 'numpy' module, HyBi protocol will be slower WARNING: no 'resource' module, daemonizing is disabled Traceback (most recent call last): File "", line 1, in File "D:\Python32\lib\multiprocessing\forking.py", line 375, in main self = load(from_parent) EOFError

alexchandel commented 4 years ago

Python 2 was end-of-lifed on January 1. Python 3.8 has complete Windows support for non-blocking TCP & UDP asyncio. Convert websockify to use asyncio and it'll work natively on Windows.

CendioOssman commented 4 years ago

Windows support was fixed back in #388 so this should have been closed then.