You need to include a unique “.tag” with the bandwidth-test command when you issue it, and then use “/cancel” with the “=tag” parameter to identify the bandwidth-test process in order to stop it. See the documentation on the Wiki: http://wiki.mikrotik.com/wiki/Manual:API#Tags
but I’m just a newbie for coding this mikrotik command.
so how I gonna use /cancel =tag={my own tag} in my php code?
and I also login via winbox to see the process , I don’t know what is command or what menu to see the process ?
I try to create “/ip arp add 192.xxx.xxx.xxx” with tag name = arp1 and try to see and cancel with “/cancel = tag=arp1” .
it isn’t working.
Yes, you need to add a tag, run asynchronously (i.e. not wait for all responses, since you’ll never get them all without a duration), and eventually cancel.
To do that,
$client->sendAsync(
new RouterOS\Request('/tool bandwidth-test address=8.8.8.8', null, 'bt'),
function ($response) {
if ($response->getType() === RouterOS\Response::TYPE_DATA) {
//Do what you will here
//When you're ready to cancel, do this
return true;
}
}
);
//If you want to set up multiple requests at once do it in place of this,
//by repeating the above with according tweaks.
//If ready, do this
$client->loop();
Thank you for your advice.
but Could you describe and more examples about this code ?
because I am a newbie for this .
I understand some line that you example tag name = ‘bt’ , bandwidth-test ip-address = ‘8.8.8.8’, $response->getType() = show result that you want to see.
if I do,
$client->sendAsync(
new RouterOS\Request('/tool bandwidth-test address=8.8.8.8', null, 'bt'),
function ($response) {
if ($response->getType() === RouterOS\Response::TYPE_DATA) {
// I want to see result like this
echo 'duration : '.$response->getProperty('duration')."\n";
echo 'tx-current : '.$response->getProperty('tx-current')."\n";
echo 'rx-current : '.$response->getProperty('rx-current')."\n";
//When you're ready to cancel, do this
//return true;
}
}
);
//If you want to set up multiple requests at once do it in place of this,
//by repeating the above with according tweaks.
//If ready, do this
$client->loop();
how do I send
return true;
into the code to stop bandwidth-test like code above that you example to me.