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

Help set up the connection #240

Open
MGMehdi opened this issue May 17, 2024 · 0 comments
Open

Help set up the connection #240

MGMehdi opened this issue May 17, 2024 · 0 comments

Comments

@MGMehdi
Copy link

MGMehdi commented May 17, 2024

Hello,

I try to set up the package for a simple connection without login. I've try some example but it seem that the connection doesn't work. The code have to work on Windows and the connection is working using the telnet client feature.

Here is the code

import { Telnet } from "telnet-client";
const connection = new Telnet();

// these parameters are just examples and most probably won't work for your use-case.
const params = {
  host: "192.168.10.112",
  port: 4567,
  negotiationMandatory: false,
};

connection.on("ready", (prompt) => {
  console.log("prompt", prompt);

  connection.exec(cmd, (err, response) => {
    console.log("rep", response);
  });
});

connection.on("timeout", () => {
  console.log("socket timeout!");
  connection.end();
});

connection.on("close", () => {
  console.log("connection closed");
});

connection.connect(params);

And here is the result

socket timeout!
connection closed

Thanks

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

1 participant