Module Module1
Sub Main()
Dim objSnmp2 As ASOCKETLib.Snmp2
Dim objConstants As Constants
Dim strAgent As String
Dim strCommunity As String
Dim strOID As String
Dim strNextOID As String
Dim strValue As String
objSnmp2 = New ASOCKETLib.Snmp2()
objConstants = New Constants()
strAgent = "127.0.0.1"
strCommunity = "public"
strOID = "system.sysName.0"
objSnmp2.Open(strAgent, strCommunity)
Console.WriteLine("Open( " & strAgent & ", " & strCommunity & "), result: " & objSnmp2.LastError & " (" & objSnmp2.GetErrorDescription(objSnmp2.LastError) & ")")
If (objSnmp2.LastError = objConstants.asERR_SUCCESS) Then
Do
strValue = objSnmp2.Get(strOID)
Console.WriteLine(strOID + " : ")
Console.WriteLine("Value:" & strValue & "Type:" & objSnmp2.GetType())
' NOTE: the Types retunred by GetType() are explained in constants.cs
strNextOID = objSnmp2.GetNext(strOID)
strOID = strNextOID
Loop Until (objSnmp2.LastError <> 0)
End If
Console.WriteLine("Ready.")
System.Threading.Thread.Sleep(10000)
End Sub
End Module