C# 實現的SNMP庫 SNMP#NET
這是用 C# 語言實現的簡單網絡管理協議SNMP 庫,支持的版本包括1/2/3
示例代碼:
string host = "localhost";
string community = "public";
SimpleSnmp snmp = new SimpleSnmp(host, community);
if (!snmp.Valid)
{
Console.WriteLine("SNMP agent host name/ip address is invalid.");
return;
}
Dictionary result = snmp.Get(SnmpVersion.Ver1, new string[] { ".1.3.6.1.2.1.1.1.0"} );
if (result == null)
{
Console.WriteLine("No results received.");
return;
}
foreach (KeyValuePair kvp in result)
{
Console.WriteLine("{0}: {1} {2}", kvp.Key.ToString(),
SnmpConstants.GetTypeName(kvp.Value.Type), kvp.Value.ToString());
}
本文由用戶 fmms 自行上傳分享,僅供網友學習交流。所有權歸原作者,若您的權利被侵害,請聯系管理員。
轉載本站原創文章,請注明出處,并保留原始鏈接、圖片水印。
本站是一個以用戶分享為主的開源技術平臺,歡迎各類分享!