How to get value of oid type OctetString

922 views Asked by At

I am trying to get OID value (in string format) from Snmp device by using Lextm.SharpSnmpLib.Messaging. it is displaying correctly for normal OID values, but while converting for Mac address containing('-') it does not converts properly and displays "\u0000 k???" any conversion recommendations, here is the code attached.

IList<Variable> result = Messenger.Get(VersionCode.V1,
                         new IPEndPoint(IPAddress.Parse(sIpAddress), 
                         objSNMPv1Setting.Port),
                         new OctetString(objSNMPv1Setting.CommunityName), 
                         lstOid.Select(x => new Variable(new ObjectIdentifier(x))).ToList(),
                         objSNMPv1Setting.Timeout);

foreach (var o in result)
{            
    dictResponce.Add(o.Id.ToString(), o.Data.ToString());         
}

OID Value : ABC

o.Data.ToString() = ABC

OID Value :00-20-6B-93-EC-81

o.Data.ToString() = \u0000 k???

Expected

OID Value :00-20-6B-93-EC-81

o.Data.ToString() = 00-20-6B-93-EC-81
0

There are 0 answers