Quantcast
Channel: C# Based Open Source SNMP Library for .NET and Mono
Viewing all articles
Browse latest Browse all 576

Closed Issue: Strange characters returned by Messenger.Get [7233]

$
0
0
Hello,
I have discovered a problem using the Messenger.Get function. I have written a function that given an OID and the host, returns the response as a string.
With OID = "1.3.6.1.4.1.11.2.3.9.1.1.7.0" against a printer Samsung ML-4550, I usually have this value as return:

"MODEL:SAMSUNG ML 4550ND;CLASS:PRINTER;DESCRIPTION:SAMSUNG Network Printer;OS 1.10.11.86 07-30-2010; V3.03.03_SEI_1_1.02;"

but sometimes (+or- 30% of times) the function returns a string which is the above one, but trailed with strange characters: char(1), char(63), char(63), char(63). I have this problem only with this printer, so it might be an hardware problem, but the fact that there are these strange character suggests me that maybe the parser of the incoming message can have a bug.
Below you can find the source code of my function (vb.net, sorry!):


''' <summary>
''' Get SNMP variable given address and oid
''' </summary>
''' <param name="host">IP address of the device</param>
''' <param name="oid">OID</param>
''' <returns>List of SNMP data</returns>
''' <remarks></remarks>
Private Function GetVariable(host As IPAddress, oid As String) As String
Dim version As VersionCode = V1

Dim receiver As Net.IPEndPoint = New Net.IPEndPoint(host, 161)

Dim vList As New List(Of Variable)()
Dim test As New Variable(New ObjectIdentifier(oid))
vList.Add(test)

Dim mylist As System.Collections.Generic.IList(Of Lextm.SharpSnmpLib.Variable) = Nothing
mylist = Messenger.[Get](version, receiver, New OctetString("public"), vList, 3000)

Dim res As String = ""
For Each Vari As Variable In mylist
res = res + Vari.Data.ToString()
Next

Return res
End Function


Viewing all articles
Browse latest Browse all 576

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>