Get Active Users on Csharp api

I am having trouble with taking online users on C# API.

This code is not working:

mikrotik.Send(“/ip/hotspot/active/print”);
mikrotik.Send(“=detail”);
foreach (string h in mikrotik.Read())
{
Console.WriteLine(h);
}

Anyone knows which syntax i have to follow?

Thanks;

mikrotik.Send("/ip/hotspot/active/print");
mikrotik.Send("=detail=");

or instead of print use getall

Uhm, its not working either.all i did is opening a new connection and execute that code.

taking the version information is working, but i cant take the users. what could be the problem?

You mean i can use the “getall” command instead? What is it’s notation?

mikrotik.Send(“=detail=”, true);

You have to set true for the last line of the command.

Thanks! It worked this time.

and

This should be updated in the API wiki. It specifically states that any parameter for the print command will be ignored.

And can someone explain the (“=detail=”,true)? What character is sent as that last character if ‘true’ is a boolean value, like in Java (the language, not the country)? I presume it is a zero character sent. True?

print and getall in API is the same command. Thus print returns all the values in API, so, =detail= flag have no meaning.

EDIT: again, please see all possible information about API implementation you are going to use. It is essential, to see subtle differences, when and what parameters should be set.

For example Java implementation i am using takes full API sentence and then alters it and sends it to router, so i do not have to think, what and where should be set. Whilst a lot of implementations requires user to specify, with true/false that this is the end of API sentence.

Thanks! So print and getall are like “print detail” and “print advanced” by default with no need for a parameter. Good deal!

And “true” means append the zero character. I don’t use that method either. I’m teaching mine to do it automatically.