I am sending SNMP SystemName query to local host and in response i m getting little square characters instead of the specific system name..
And this is the output m getting
Device SNMP Information:
sysName - Datatype: 48, [][][][]
Code:
Imports System.Text
Class Form1
Dim commlength As Integer, miblength As Integer, datatype As Integer, datalength As Integer, datastart As Integer
Dim uptime As Integer
Dim output As String
Dim conn As New SNMP()
Dim response As Byte() = New Byte(1023) {}
'Public Shared Sub Main(ByVal argv As String())
'End Sub
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
IPaddress.Text = "115.186.115.188"
Community.Text = "public"
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
ListBox1.Items.Add("Device SNMP information:")
' Send sysName SNMP request
response = conn.[get]("get", IPaddress.Text, Community.Text, "1.3.6.1.2.1.1.5.0")
If response(0) = &HFF Then
ListBox1.Items.Add("No response from " & IPaddress.Text)
Return
End If
' If response, get the community name and MIB lengths
commlength = Convert.ToInt16(response(6))
miblength = Convert.ToInt16(response(23 + commlength))
' Extract the MIB data from the SNMP response
datatype = Convert.ToInt16(response(24 + commlength + miblength))
datalength = Convert.ToInt16(response(25 + commlength + miblength))
datastart = 26 + commlength + miblength
output = Encoding.ASCII.GetString(response, datastart, datalength)
ListBox1.Items.Add(" sysName - Datatype:" & datatype & "," & output)
Device SNMP Information:
sysName - Datatype: 48, [][][][]
Comment