SNMP C# Example
SNMPGet
->
SNMPGetNext
SNMPGetBulk
SNMPSet
Download
Full Trial (998KB)
eMarkSnmpTrial.zip
ActiveX/Component Library
Active Server Flash
Active Server Image
eMarkSNMP Get C# Sample
C# SNMP Get
At first, add reference to Interop.eMarkSnmpLib.dll.
using System; using System.Collections.Generic; using System.Text; using eMarkSnmpLib; namespace SnmpGet { class Program { static void Main(string[] args) { SnmpSession snmpSession = new SnmpSession(); snmpSession.Open(); try { int count = snmpSession.SnmpGet("127.0.0.1", "1.3.6.1.2.1.1.1.0"); if (count > 0) { Console.WriteLine("Got varbinds: " + count.ToString()); Console.WriteLine("Snmp VarBinding: "); Console.WriteLine("Oid: " + snmpSession.VarBinds[1].ObjectID); Console.WriteLine("StringValue: " + snmpSession.VarBinds[1].ToString()); Console.WriteLine("HexValue: " + snmpSession.VarBinds[1].ToHexString()); } } catch (Exception ex) { Console.WriteLine("Got an error: " + ex.Message); } snmpSession.Close(); return; } } }