Я могу сделать telnet, используя командную строку, но получаю сообщение об ошибке через NodeJs
'use strict'
const Telnet = require('telnet-client')
async function run() {
let connection = new Telnet()
let params = {
host: 'linuxserver123',
port: 1603,
shellPrompt: '/ # ',
timeout: 4500
}
try {
await connection.connect(params)
} catch(error) {
}
let res = await connection.exec('uptime')
console.log('async result:', res)
}
run()
Я получаю ошибку ниже:
Эта ошибка исходит от connect()
errer connecting Error: Socket ends
at Socket.socket.on (project/lib/index.js:110:18)
at emitNone (events.js:110:20)
at Socket.emit (events.js:207:7)
at endReadableNT (_stream_readable.js:1059:12)
at _combinedTickCallback (internal/process/next_tick.js:138:11)
at process._tickCallback (internal/process/next_tick.js:180:9)
(node:12139) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): Error: socket not writable
(node:12139) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.