I am running into issues running SNMP get commands with the snmpsharpnet library. I am working off of an example that they provide for running a simple get, but it errors out. I have tested running this OID against the box and I am able to get a response, but I can't with this program
My code looks like this:
try{
SimpleSnmp snmp = new SimpleSnmp(HOST, COMMUNITY);
Pdu pdu = new Pdu();
//pdu.Type = SnmpConstants.GETNEXT; // type GETNEXT
pdu.VbList.Add(".1.3.6.1.2.1.1.1.0");
Dictionary<Oid, AsnType> result = snmp.Get(SnmpVersion.Ver2,pdu); //.GetNext(pdu);
if (result == null){
Console.WriteLine("Request failed.");
}else{
foreach (KeyValuePair<Oid, AsnType> entry in result)
{
Console.WriteLine("{0} = {1}: {2}", entry.Key.ToString(), SnmpConstants.GetTypeName(entry.Value.Type),
entry.Value.ToString());
}
}
}catch (Exception ex){
Console.WriteLine("Error: " + ex + Environment.NewLine + "-------------------------------------------------------");
}
The Error I receive looks like this:
A first chance exception of type 'System.Net.Sockets.SocketException' occurred in System.dll
A first chance exception of type 'System.Net.Sockets.SocketException' occurred in System.dll
A first chance exception of type 'System.Net.Sockets.SocketException' occurred in System.dll
A first chance exception of type 'SnmpSharpNet.SnmpException' occurred in SnmpSharpNet.dll
The thread 0xeec has exited with code 259 (0x103).
Thanks in advance!