Closed cvhariharan closed 5 years ago
difficult to tell just from the error. Can you double check ip / port values are correct? Can you connect with some other client?
I am able to connect with RealVNC viewer, the port and IP all seem to be correct.
is this the only connection? Some vnc servers try to close all existing connections whenever new connection is made
I think I may have found out the issue. Seems like a problem with calling requestUpdate. Commenting it out, the connection is successful.
hm, updates are not sent automatically, usually a send 'requestUpdate' command immediately after receiving update. Do you receive any data after commenting this out?
I am able to receive clipboard and resize events.
I think requestUpdate
is for screen rectangles, resize & clipboard sent automatically ( but I might be wrong here and could be server specific )
I don't think I am able to receive any screen updates after commenting out requestUpdate
Is there an easy way to replicate your issue? What's your os?
OS: Windows 10 64 bit VNC server: TightVNC 2.8.11 with localhost connection enabled Node v10.16.0 Rfb2 0.2.0 NPM 6.9.0
var rfb = require('rfb2');
var r = rfb.createConnection({
host: 'localhost',
port: 5900,
password: 'password'
});
r.on('connect', function() {
console.log('successfully connected and authorised');
console.log('remote screen name: ' + r.title + ' width:' + r.width + ' height: ' + r.height);
});
r.on('error', function(error) {
console.error(error);
});
r.on('rect', function(rect) {
console.log(rect.encoding)
});
r.on('resize', function(rect) {
console.log('window size has been resized! Width: %s, Height: %s', rect.width, rect.height);
});
r.on('clipboard', function(newPasteBufData) {
console.log('remote clipboard updated!', newPasteBufData);
});
r.on('bell', console.log.bind(null, 'Bell!!'));
// r.requestUpdate(false, 0, 0, r.width, r.height);
you can only do requestUpdate
after client is connected, otherwise you write this command before connection handshake is finished
Oh, that fixed the issue. Thanks a lot!
just tried on windows laptop and not I'm getting any screen updates, did you have any luck?
Note that requestUpdate
is sent after connection automatically - https://github.com/sidorares/node-rfb2/blob/822d0eafc3604abad57996faa208aaa1acb9a4cb/rfbclient.js#L241
I should really update readme, the code is just a list of supported methods, not a working example
No, I don't seem to receive any updates
just tried on windows laptop and not I'm getting any screen updates, did you have any luck?
Note that
requestUpdate
is sent after connection automatically -
No, I don't seem to receive any updates
you need to pass non empty list of supported encodings:
var r = rfb.createConnection({
host: 'localhost',
port: 5900,
password: 'password',
encodings: [rfb.encodings.raw]
});
actually, it's set bu default to [raw, copyRect, pseudoDesktopSize]
but for some reasons I only get updates when set it to raw
only
The event, rect
would be triggered whenever there is a screen update right? If that's the case, I am still not receiving the update events after the initial one.
I'm getting updates now with [rfb.encodings.raw]
Do we have to call requestUpdate
in the callback for rect
?
yes
While I try to connect to TightVNC server using the example code provided in the README, I get this error
{ Error: read ECONNRESET at TCP.onStreamRead (internal/stream_base_commons.js:111:27) errno: 'ECONNRESET', code: 'ECONNRESET', syscall: 'read' }
This could be a simple issue but any help would be appreciated.