Closed AsafMag closed 6 years ago
Hi, do you have sample code? Sounds very unlikely tu me ... D
var a = new Thread(() =>
{
while (true)
{
var command = connection.CreateCommand("/system/health/print");
command.ExecuteSingleRow();
}
});
var b = new Thread(() =>
{
while (true)
{
var command = connection.CreateCommand("/system/health/print");
command.ExecuteSingleRow();
}
});
a.Start();
b.Start();
One of them throws when you start b. https://wiki.mikrotik.com/wiki/Manual:API#Tags
I tried adding this parameter myself, but it wasn't added in the correct location as expected (compared to other libraries).
Could you please explain the reason for running two synchronous commands in parallel way? Tags are (of course) supported by async methods - ExecuteAsync.
Thanks, D
Actually I've been using ExecuteListWithDuration
which uses ExecuteAsync
internally, this solves the issue, I dropped the usage of ExecuteSingleRow
. This now relates to what we were talking about in issue #26 - canceling one sniffing command cancels all other active ones, even though there is a tag attached to them.
Well,
I have added some support for sending .tag embeded in command rows / parameters witch could be also solution (see connected commit). Just to add more intuitive interface. But ExecuteAsync
(and ExecuteListWithDuration
) is the solution I would preffer.
D
Hello,
A tag is not attached to sent commands, which makes them take each others' responses as their own when sent in parallel.
I'm using a version of late 2017 and haven't seen a change in the latest version.