C#下利用SnmpSharpNet进行snmp开发.doc

  1. 1、本文档共6页,可阅读全部内容。
  2. 2、有哪些信誉好的足球投注网站(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。
  3. 3、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载
  4. 4、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
查看更多
C#下利用SnmpSharpNet进行snmp开发 ??? 最近需要在c#下面开发snmp的应用,其实我的需求很简单,就是通过一个oid可以获得一个值。在网上有哪些信誉好的足球投注网站了 一些,发现很多文章都是 你抄袭我我抄袭你,基本上拷贝下来是不能运行的,还有的一些利用系统库,有一些用付费的库。 ??? 在网上有哪些信誉好的足球投注网站了一下,发现有一个库相当的好用,SnmpSharpNet。官方网站为/。如果有需要请到官方网站上去下载开源的二进制文件,其中各个的介绍也相当的全面。在进行开发之前请先导入引用。 ???? 在snmp的语句中有两种语句,snmpget/snmpwalk我觉得这两个是我用的最多的,snmpget就是通过oid进行查找,而snmpwalk可以返回一个组中的数据。下面两段程序演示了具体怎么使用。 snmpget:源地址:/getexample.html using System; using System.Net; using SnmpSharpNet; namespace snmpget { class Program { static void Main(string[] args) { // SNMP community name OctetString community = new OctetString(public); // Define agent parameters class AgentParameters param = new AgentParameters(community); // Set SNMP version to 1 (or 2) param.Version = (int)SnmpVersion.Ver1; // Construct the agent address object // IpAddress class is easy to use here because // it will try to resolve constructor parameter if it doesnt // parse to an IP address IpAddress agent = new IpAddress(); // Construct target UdpTarget target = new UdpTarget((IPAddress)agent, 161, 2000, 1); // Pdu class used for all requests Pdu pdu = new Pdu(PduType.Get); pdu.VbList.Add(..0); //sysDescr pdu.VbList.Add(..0); //sysObjectID pdu.VbList.Add(..0); //sysUpTime pdu.VbList.Add(..0); //sysContact pdu.VbList.Add(..0); //sysName // Make SNMP request SnmpV1Packet result = (SnmpV1Packet)target.Request(pdu, param); // If result is null then agent didnt reply or we couldnt parse the reply. if (result != null) { // ErrorStatus other then 0 is an error returned by // the Agent - see SnmpConstants for error definitions if (result.Pdu.ErrorStatus != 0) { // age

文档评论(0)

浅唱愁淡 + 关注
实名认证
内容提供者

该用户很懒,什么也没介绍

1亿VIP精品文档

相关文档