Hi all,
I am trying to use the example from the wiki in a simple vb .net application. I am unable to communicate with the router. I get a host not found error.
My code is below.
Module Module1
'function from http://www.planet-source-code.com/vb/sc ... &lngWId=10
Private Function IPToInteger(ByVal Expression As String) As Integer
Try
Dim IPAddress As System.Net.IPAddress = System.Net.IPAddress.Parse(Expression)
With IPAddress
Return (System.Convert.ToInt32(.GetAddressBytes(3)) << 24) Or (System.Convert.ToInt32(.GetAddressBytes(2)) << 16) Or (System.Convert.ToInt32(.GetAddressBytes(1)) << Or System.Convert.ToInt32(.GetAddressBytes(0))
End With
Catch ex As Exception
Return 0I
End Try
End Function
Sub Main()
Dim l As Long
l = IPToInteger("192.168.88.1")
Dim mk = New Mikrotik(l)
If Not mk.Login("admin", "pwd") Then
Console.WriteLine("Cant log in")
mk.Close()
Console.ReadLine()
Return
End If
mk.Send("/system/clock/getall", True)
For Each row In mk.Read()
Console.WriteLine(row)
Next
Console.ReadLine()
End Sub
End Module
I have not changed anything in the class from the wiki so am not posting that.