Comments (11)
private onTimeout(): void {
this.destroy();
this.emit(
'timeout',
new RosException('SOCKTMOUT', { seconds: this.timeout }),
this,
);
}
Move this.destroy();
before this.emit(...)
solving this problem.
node-routeros/src/connector/Connector.ts
Line 246 in f7d710e
from node-routeros.
A workaround for now would be to append some random string after the name.
from node-routeros.
Resolved.
After the name error the connection was open, I forced a disconnection and a new connection.
thank you!
from node-routeros.
@jocasousa can you please share your code for reference!!
from node-routeros.
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 can you please share your code for reference!!
:)
from node-routeros.
Thank you ...Now my code is working.
in your code your setting address by using parameters.that's great.....
from node-routeros.
@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.
@aluisiora RosException.
from node-routeros.
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.
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)
- Timed out after 10 seconds HOT 6
- How to detect RouterOSAPI.stream's end HOT 9
- TypeScript's d.ts files are missing HOT 2
- Is this possible?
- RosException - https://github.com/aluisiora/routeros-client/issues/8 HOT 5
- processRawData bug... HOT 17
- Connection error leaving command promises orphaned HOT 3
- When using TLS, connection close promise never gets resolved
- Stream data to object HOT 2
- Help to create a ping streaming script HOT 3
- can we print ip address by using particular ID ? HOT 1
- how to query export command in con.write() ?
- its gives no such command,since its valid command in mikrotik router HOT 1
- Getting Log Records by Topic Name
- Documentation
- someone can help me pls to implement this mikrotik script on node-routeros thx
- RosException CANTLOGIN Username or password is invalid HOT 1
- Update to post-v6.43 api login method HOT 1
- remove by id doesn't work HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from node-routeros.