sidorares / node-rfb2

rfb wire protocol client and server
MIT License
138 stars 27 forks source link

ultravnc_repeater: short read 10 != 250 throws EPIPE #20

Open zxfrank opened 8 years ago

zxfrank commented 8 years ago

While trying to connect to ultravnc repeater, I get the error:

{ [Error: This socket has been ended by the other party] code: 'EPIPE' }

and on the repeater

new vnc client connecting.
ULTRAVNC_REPEATER_NO_RFB: not sending RFB 000.000
ultravnc_repeater: short read 10 != 250

my settings to connect to the repeater are:

{
    "host"    : 'myrepeater.example.com',
     "port"    : '123456',
      "password": '+ID:12345678'
}

Is there a trick to make magic happen or is it just me?

thanks for your help

sidorares commented 8 years ago

I haven't used ultravnc repeater before, can you give a short intro on how to setup everything @zxfrank ? Alternatively, if you can provide network dump around disconnect time that would be helpful. Looks like ultravnc does not like something and closes connection

zxfrank commented 8 years ago

ultravnc repeater log only the 3 lines. The nodejs app log the error again and again and again freakin fast. It occurs on init.

I have an old version of the repeater, I will try with the latest tomorrow.

the exact string in ssvnc (proxy/Gateway) to connect is:

repeater://hostname:port+ID:_ANY_CHARS

http://www.uvnc.com/downloads/repeater/83-repeater-downloads.html

sidorares commented 8 years ago

thanks, I'll try to play with repeater on my side

zxfrank commented 8 years ago

Ok now on the latest version of the repeater I got

{ [Error: read ECONNRESET] code: 'ECONNRESET', errno: 'ECONNRESET', syscall: 'read' }
[Error: This socket is closed.]
[Error: This socket is closed.]
[Error: This socket is closed.]
[Error: This socket is closed.]
[Error: This socket is closed.]
[Error: This socket is closed.]
[Error: This socket is closed.]

then on repeater log

UltraVnc Fri Jul 15 08:48:55 2016 > routeConnections(): new server connecting, accepting...
UltraVnc Fri Jul 15 08:48:55 2016 > acceptConnection(): connection accepted ok from ip: 127.0.0.1
UltraVnc Fri Jul 15 08:48:55 2016 > nonBlockingRead(): start
UltraVnc Fri Jul 15 08:48:58 2016 > nonBlockingRead(): returning normally
UltraVnc Fri Jul 15 08:48:58 2016 > checkIdCode():  is not IdCode string
UltraVnc Fri Jul 15 08:48:58 2016 > acceptConnection(): mode 1 connections are not allowed, closing connection

It looks like rfb is trying to connect in standard mode instead of (oh my god I had a flash) proxy.

We need to supply proxy parameters in the connection params! like with ssvnc... Is it implemented? if not, do you have an idea where to start?

thanks

sidorares commented 8 years ago

What kind of proxy is that?

sidorares commented 8 years ago

You can pass any duplex stream as a parameter using stream option, see https://github.com/sidorares/node-rfb2/blob/master/rfbclient.js#L617

For socks proxy for example you can use code similar to https://github.com/sidorares/node-mysql2#connecting-using-custom-stream

zxfrank commented 8 years ago

UltraVNC Repeater http://www.uvnc.com/products/uvnc-repeater.html

is acts as a gateway, the manager connects to it and client reverse connect so you don't have to open firewall

sidorares commented 8 years ago

so from the client point of view repeater acts like a normal vnc server?

zxfrank commented 8 years ago

It depends on the mode, I use the mode 2. The repeater is like a gateway, receive connections from both sides and link them together. There's no firewall to configure, it works from anywhere.

zxfrank commented 8 years ago

Maybe we could get some ideas from noVNC https://github.com/kanaka/noVNC/issues/103