Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions lib/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ Server.init = function(port, host, options) {
var self = this;

if (!parseInt(port)) {
throw new Error('in node-nc server the port is mandatory!');
throw new Error('in node-nc server the port is mandatory!');
}

// check args
Expand All @@ -36,16 +36,17 @@ Server.init = function(port, host, options) {
this._port = port;
this._host = host || 'localhost';
this.timeout = (options && options.timeout) || 3600000;
var _Server = this;

function handler(socket) {
var client = socket.remoteAddress + ':' + socket.remotePort;

// socket configurations
socket.setKeepAlive(true, 60000);
socket.setTimeout(this._timeout);
socket.setTimeout(_Server.timeout);

if (options && options.readEncoding) {
socket.setEncoding(options.readEncoding);
socket.setEncoding(options.readEncoding);
}

//
Expand Down Expand Up @@ -153,7 +154,7 @@ Server.prototype.send = function(client, msg, end, cb) {
new Error(),
client,
msg);
cb();
cb();
}
};

Expand Down