Posts Tagged 例程

ros winbox api 应用

Posted by on 星期五, 18 二月, 2011

winbox api VB.net 类库:cls_Mikrotik.vb

代码:

Dim mk = New Mikrotik("192.168.0.1")
Dim strUsername As String, strGrid() As String
If Not mk.Login("admin", "Mikrotik_hhsoft") Then
mk.Close()
Return
End If

mk.Send("/ppp/active/print", True)
For Each row In mk.Read()
If InStr(row, "!done") = 0 Then
strGrid = Split(row, "=")
Console.WriteLine(strGrid(4) & vbTab & vbTab & strGrid(12))
End If
Next

返回的数据包:

!re=.id=*139=name=malidan=service=pppoe=caller-id=00:11:43:57:B9:0F=address=172.16.0.108=uptime=00:22:14=encoding==session-id=2167406760=limit-bytes-in=0=limit-bytes-out=0=radius=true
!re=.id=*13A=name=zhaoliang=service=pppoe=caller-id=00:E0:4D:A5:B2:5E=address=172.16.0.107=uptime=00:13:41=encoding==session-id=2167406761=limit-bytes-in=0=limit-bytes-out=0=radius=true
!done