Audiovox P965 Scheda Tecnica Pagina 91

  • Scaricare
  • Aggiungi ai miei manuali
  • Stampa
  • Pagina
    / 280
  • Indice
  • SEGNALIBRI
  • Valutato. / 5. Basato su recensioni clienti
Vedere la pagina 90
MikroNode
88
unaltered.
channel.close(force)
Close the channel. If there are any commands still waiting to be executed, they will be completed before
closing the channel.
If force is TRUE, then the channel is immediately closed. If the channel is running, the cancel command
is sent to stop any running listen commands, or potentially long running output.
Examples
Connect to a Mikrotik, and add an address to ether1
var api = require('mikronode');
var connection = new api('192.168.0.1','admin','password');
connection.connect(function(conn) {
var chan=conn.openChannel();
chan.write(['/ip/address/add','=interface=ether1','=address=192.168.1.1'],function() {
chan.on('trap',function(data) {
console.log('Error setting IP: '+data);
});
chan.on('done',function(data) {
console.log('IP Set.');
});
chan.close();
conn.close();
});
});
Writing the program for the example API conversation on the Mikrotik Wiki
var api = require('mikronode');
var connection = new api('192.168.0.1','admin','password');
connection.connect(function(conn) {
conn.closeOnDone(true);
var chan2=conn.openChannel(2);
chan2.write('/interface/listen',function(chan) {
chan.on('read',function(data) {
packet=api.parseItems([data])[0];
console.log('Interface change: '+JSON.stringify(packet));
});
});
var chan3=conn.openChannel(3);
chan3.closeOnDone(true);
Vedere la pagina 90
1 2 ... 86 87 88 89 90 91 92 93 94 95 96 ... 279 280

Commenti su questo manuale

Nessun commento