MikroTik 和 c# API:使用“:put”命令获取收音机名称
MikroTik and c# API: get radio-name with ':put' command
我有一个问题。我想通过 C# api 为 winbox 获取收音机名称。在 winboxs 终端中工作 :put [/interface wireless get [/interface wireless find default-name=wlan1] radio-name]
命令,但在 C# api 中不工作。我骑着它,在 api 中我不能使用 [ ] 标记,但我不知道没有它它是怎么写的。我这样试过:
mikrotik.Send("/put ", true);
mikrotik.Send(".system identity get name", true);
foreach (string h in mikrotik.Read())
{
mkResult += h;
}
l_identify.Text = mkResult;
但它不起作用。每次我得到这个:
!trap=category=0=message=no such command or directiory (put [)!trap=message=no such command prefix!done
请帮忙:<
PS: 对不起我的英语:P
您正在向设备发送错误的命令。
你需要使用这个:
/interface/wireless/print
=.proplist=radio-name
?default-name=wlan1
.proplist
包含要返回的字段列表,?default-name=wlan1
是过滤条件。
您可以在 official Wiki.
中找到有关 Mikrotik API 语法的更多信息
我有一个问题。我想通过 C# api 为 winbox 获取收音机名称。在 winboxs 终端中工作 :put [/interface wireless get [/interface wireless find default-name=wlan1] radio-name]
命令,但在 C# api 中不工作。我骑着它,在 api 中我不能使用 [ ] 标记,但我不知道没有它它是怎么写的。我这样试过:
mikrotik.Send("/put ", true);
mikrotik.Send(".system identity get name", true);
foreach (string h in mikrotik.Read())
{
mkResult += h;
}
l_identify.Text = mkResult;
但它不起作用。每次我得到这个:
!trap=category=0=message=no such command or directiory (put [)!trap=message=no such command prefix!done
请帮忙:<
PS: 对不起我的英语:P
您正在向设备发送错误的命令。
你需要使用这个:
/interface/wireless/print
=.proplist=radio-name
?default-name=wlan1
.proplist
包含要返回的字段列表,?default-name=wlan1
是过滤条件。
您可以在 official Wiki.
中找到有关 Mikrotik API 语法的更多信息