Giter Site home page Giter Site logo

Comments (11)

renomureza avatar renomureza commented on June 15, 2024 1
private onTimeout(): void {
        this.destroy();
        this.emit(
            'timeout',
            new RosException('SOCKTMOUT', { seconds: this.timeout }),
            this,
        );
    }

Move this.destroy(); before this.emit(...) solving this problem.

from node-routeros.

aluisiora avatar aluisiora commented on June 15, 2024

A workaround for now would be to append some random string after the name.

from node-routeros.

jocasousa avatar jocasousa commented on June 15, 2024

Resolved.
After the name error the connection was open, I forced a disconnection and a new connection.

thank you!

from node-routeros.

melsonmascarenhas avatar melsonmascarenhas commented on June 15, 2024

@jocasousa can you please share your code for reference!!

from node-routeros.

melsonmascarenhas avatar melsonmascarenhas commented on June 15, 2024

I'm getting this error when i run example code

    at Connector.onTimeout (D:\mikrotik\node_modules\node-routeros\dist\connector\Connector.js:187:30)
    at Object.onceWrapper (events.js:416:28)
    at Socket.emit (events.js:310:20)
    at Socket._onTimeout (net.js:479:8)
    at listOnTimeout (internal/timers.js:549:17)
    at processTimers (internal/timers.js:492:7) {
  name: 'RosException',
  errno: 'SOCKTMOUT',
  message: 'Timed out after 10 seconds' ```

from node-routeros.

jocasousa avatar jocasousa commented on June 15, 2024

@jocasousa can you please share your code for reference!!
Screenshot_1

:)

from node-routeros.

melsonmascarenhas avatar melsonmascarenhas commented on June 15, 2024

Thank you ...Now my code is working.
in your code your setting address by using parameters.that's great.....

from node-routeros.

aluisiora avatar aluisiora commented on June 15, 2024

@jocasousa if you listen for error on the connection object, what info does it give?

Example:

conn.on('error', (err) => {
    console.log(err);
});

conn.connect()[...]

from node-routeros.

jocasousa avatar jocasousa commented on June 15, 2024

@aluisiora RosException.

from node-routeros.

aluisiora avatar aluisiora commented on June 15, 2024

Seems like the error is bubbling up to the connection socket object, which shouldn't happen. I'm not having a free time lately to make a sample code to replicate this, so it might take some time to fix.

from node-routeros.

xeleniumz avatar xeleniumz commented on June 15, 2024

after I spent my time to test this error. I found the solution you can use promise way to work around this problem , here is my example code.

 let conn = new RouterOSAPI  ({
        host: '10.0.0.1',
        user: 'admin',
        password: 'password',
    });
  return new Promise(async (resolve,reject) => {
            conn.connect()
                .then(() => {
                    conn.write("/interface/print").then((data) => {
                        // Got the interfaces
                        conn.close();
                        resolve(data);
                    }).catch((err) => {
                        // Got error trying to print the interfaces
                        console.log(err);
                        reject(err);
                    });
            }).catch((err) => {
                // Got an error while trying to connect
                console.log(err);
                reject(err);
            });
        });

from node-routeros.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.