Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

timeout to exec command #221

Open
gabrielmatau79 opened this issue Sep 13, 2022 · 1 comment
Open

timeout to exec command #221

gabrielmatau79 opened this issue Sep 13, 2022 · 1 comment

Comments

@gabrielmatau79
Copy link

Hello Mates,

I have a problem with exec command in the client telnet, always throws me a time out error can you help me please. the most extrange is that in event (data) i can see the result about cmd.

this it my code:

connection.on('ready', async (cn) => {
console.log("CONEXION REALIZADA");
try {
const res = await connection.exec("selftest", { execTimeout: 2000, maxBufferLength: 7048576, timeout: 4000 });
console.log("**RESULTADO DE LA CONEXION", res);
} catch (err) {
//console.log("Error en el comando: ", err)
}

});

this it the throws

LOG DATA: selftest

Error en el comando: Error: response not received
at Timeout._onTimeout (C:\Users\Gabriel Mata\Documents\desarrollo\utils\node_modules\telnet-client\lib\index.js:243:36)
at listOnTimeout (node:internal/timers:559:17)
at processTimers (node:internal/timers:502:7)

@call8arshad
Copy link

@gabrielmatau79
try using connection.send(cmd) you have to listen on data, check the below code.

connection.on('data', data => {
  console.log('>> ', data.toString());
})

connection.send(cmd)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants