Mike12345
Joined: 16 Jan 2008 Posts: 2
|
Posted: Wed Jan 16, 2008 9:40 am Post subject: Getnext() or Walk() |
|
|
I'm trying to get all Values from a subtree via SNMP-Getnext().
According to RFC1157 this should work without any problems. Unfortunatly if i'm using this library i have to set my OID with SNMP-GET() first (which correctly returns 22226).
The code looks like this:
| Code: |
objSnmp = (SnmpObject)objSnmpManager.Get(".1.3.6.1.4.1.14179.2.5.10");
Console.WriteLine("GET \t\t--> Errorcode: "+ objSnmpManager.LastError.ToString() + " - " +objSnmpManager.GetErrorDescription(objSnmpManager.LastError));
objSnmp = (SnmpObject)objSnmpManager.GetNext();
Console.WriteLine("GETNEXT \t--> Errorcode: " + objSnmpManager.LastError.ToString() + " - " + objSnmpManager.GetErrorDescription(objSnmpManager.LastError));
while (objSnmpManager.LastError == 0)
{
Console.WriteLine(objSnmp.OID);
Console.WriteLine(GetValueType(objSnmp.Type) + "Value: " + objSnmp.Value);
objSnmp = (SnmpObject)objSnmpManager.GetNext();
}
|
Is there a better way to get all values from a subtree ? |
|