Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

300
Vistas
When using telnet client, after using .exec command, I want to press enter key, but don't know how to do this

I am trying to connect to a router that is running on gns3 using telnet. After successful connection i want to execute some commands and want to press enter key after each command.

here is my code:

const myFunc = async () => {
  const connection = new Telnet();

  // these parameters are just examples and most probably won't work for your use-case.
  const params = {
    host: "localhost",
    port: 5000,
    shellPrompt: ">", // or negotiationMandatory: false
    timeout: 1500,
  };

  try {
    await connection.connect(params);
  } catch (error) {
    // handle the throw (timeout)
    console.log(`error: ${error}`);
  }

  const res = await connection.exec("enable");

  //here i want to press enter key

  const res1 = await connection.exec("show running-config", {
    shellPrompt: "#",
  });
  
  //here i want to press enter key
  console.log(`res1: ${res1}`);
};

After running this code, it successfully connects to router and then run the first command enable.

enter image description here

But it is not sending the enter key that why i receive the error:

enter image description here

Please guide me, how to resolve the issue.

about 4 years ago · Juan Pablo Isaza
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda