telnet-client
Advanced tools
Comparing version 0.10.3 to 0.10.4
13
app.js
@@ -8,7 +8,14 @@ var telnet = require('./lib') | ||
port: 1337, | ||
execTimeout: 1000, | ||
negotiationMandatory: false | ||
}).then(function() { | ||
connection.send('hi').then(function(res) { | ||
console.log(res) | ||
}) | ||
connection.exec('hi') | ||
.then(function(res) { | ||
console.log(res) | ||
}, function(error) { | ||
console.log(error) | ||
}) | ||
.catch(function(error) { | ||
console.log(error) | ||
}) | ||
}) |
@@ -42,2 +42,3 @@ // Node.js Telnet client | ||
? opts.negotiationMandatory : true) | ||
self.execTimeout = (typeof opts.execTimeout !== 'undefined' ? opts.execTimeout : 2000) | ||
self.sendTimeout = (typeof opts.sendTimeout !== 'undefined' ? opts.sendTimeout : 2000) | ||
@@ -103,2 +104,3 @@ | ||
self.timeout = opts.timeout || self.timeout | ||
self.execTimeout = opts.execTimeout || self.execTimeout | ||
self.irs = opts.irs || self.irs | ||
@@ -128,2 +130,8 @@ self.ors = opts.ors || self.ors | ||
}) | ||
if (self.execTimeout) { | ||
setTimeout(function() { | ||
if (!self.cmdOutput) return reject(new Error('response not received')) | ||
}, self.execTimeout) | ||
} | ||
}) | ||
@@ -130,0 +138,0 @@ } |
@@ -8,3 +8,3 @@ { | ||
}, | ||
"version": "0.10.3", | ||
"version": "0.10.4", | ||
"main": "./lib/index.js", | ||
@@ -11,0 +11,0 @@ "engine": "node >= 0.10.29", |
@@ -175,2 +175,3 @@ [![GitHub license](https://img.shields.io/github/license/mashape/apistatus.svg)](https://github.com/mkozjak/node-telnet-client/blob/master/LICENSE) | ||
Telnet client will then basically act like a simple TCP client. Defaults to true. | ||
* `execTimeout`: A timeout used to wait for a server reply when the 'exec' method is used. Defaults to 2000 (ms). | ||
* `sendTimeout`: A timeout used to wait for a server reply when the 'send' method is used. Defaults to 2000 (ms). | ||
@@ -196,2 +197,3 @@ * `debug`: Enable/disable debug logs on console. Defaults to false. | ||
of inactivity on the socket. | ||
* `execTimeout`: A timeout used to wait for a server reply when this method is used. Defaults to 'undefined'. | ||
* `irs`: Input record separator. A separator used to distinguish between lines of the response. Defaults to '\r\n'. | ||
@@ -198,0 +200,0 @@ * `ors`: Output record separator. A separator used to execute commands (break lines on input). Defaults to '\n'. |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
25995
445
256