VNC screen is visible (w/ RAW encoding). Size of VNC screen is still

hardcoded, preventing real use.
This commit is contained in:
Simo Kinnunen
2015-09-14 18:00:17 +09:00
parent 8a5f0551a7
commit 792713d415
5 changed files with 320 additions and 92 deletions

View File

@@ -1,4 +1,3 @@
var net = require('net')
var util = require('util')
var EventEmitter = require('eventemitter3').EventEmitter
@@ -8,18 +7,44 @@ var VncConnection = require('./connection')
function VncServer(server) {
this._bound = {
_connectionListener: this._connectionListener.bind(this)
_listeningListener: this._listeningListener.bind(this)
, _connectionListener: this._connectionListener.bind(this)
, _closeListener: this._closeListener.bind(this)
, _errorListener: this._errorListener.bind(this)
}
this.server = server
.on('listening', this._bound._listeningListener)
.on('connection', this._bound._connectionListener)
.on('close', this._bound._closeListener)
.on('error', this._bound._errorListener)
}
util.inherits(VncServer, EventEmitter)
VncServer.prototype.close = function() {
this.server.close()
}
VncServer.prototype.listen = function() {
this.server.listen.apply(this.server, arguments)
}
VncServer.prototype._listeningListener = function() {
this.emit('listening')
}
VncServer.prototype._connectionListener = function(conn) {
debug('connection', conn.remoteAddress, conn.remotePort)
new VncConnection(conn)
this.emit('connection', new VncConnection(conn))
}
VncServer.prototype._closeListener = function() {
this.emit('close')
}
VncServer.prototype._errorListener = function(err) {
this.emit('error', err)
}
module.exports = VncServer