关于C#下基于snmpsharpnet的snmp开发中IPV6的问题。

qq_27778559 qq_27778559 墨衍会员 · AI 创作全网分发 墨衍智能分发 通过墨衍一键同步至各平台 可同步平台 CSDN微信公众号微博知乎掘金百家号博客园抖音小红书 你的文章也可以这样分发 墨衍会员 ¥399起/年,写一次发全网 我也要 + 加入社区
在网上找到了一些获取主机的磁盘使用情况的代码:
protected void Button1_Click(object sender, EventArgs e)
{
double[] diskstorage1, diskstorage2;

diskstorage1 = snmpget("127.0.0.1", "public", 1);
this.Label1.Text += Environment.NewLine;
diskstorage2 = snmpget("fe80::357b:bacf:e6b4:5910%3", "public", 2);
//foreach (double dou in diskstorage1)
//{
// this.txtContent.Text += string.Format("{0} GB \r\n", dou.ToString("f2"));
//}
}
如上面的diskstorage2 中,将IP地址写成IPV6的地址就会发生如下错误:

Request has reached maximum retries.

说明: 执行当前 Web 请求期间,出现未经处理的异常。请检查堆栈跟踪信息,以了解有关该错误以及代码中导致错误的出处的详细信息。

异常详细信息: SnmpSharpNet.SnmpException: Request has reached maximum retries.

源错误:


行 73:
行 74: // Make SNMP request
行 75: result = (SnmpV1Packet)target.Request(pdu, param);
行 76:
行 77: // If result is null then agent didn't reply or we couldn't parse the reply.

源文件: e:\Program Files (x86)\Visual Studio 2010\WebSites\biyesheji\mange\getDISK.aspx.cs 行: 75

堆栈跟踪:


[SnmpException: Request has reached maximum retries.]
SnmpSharpNet.UdpTransport.Request(IPAddress peer, Int32 port, Byte[] buffer, Int32 bufferLength, Int32 timeout, Int32 retries) +1088
SnmpSharpNet.UdpTarget.Request(Pdu pdu, IAgentParameters agentParameters) +670
mange_Default.snmpget(String ipaddress, String comname, Int32 i) in e:\Program Files (x86)\Visual Studio 2010\WebSites\biyesheji\mange\getDISK.aspx.cs:75
mange_Default.Button1_Click(Object sender, EventArgs e) in e:\Program Files (x86)\Visual Studio 2010\WebSites\biyesheji\mange\getDISK.aspx.cs:22
System.Web.UI.WebControls.Button.OnClick(EventArgs e) +9628722
System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) +103
System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +10
System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +13
System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +35
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1724

是否是ipadress这个元数据中没有定义IPV6的相关类,还是UdpTransport中INT32需要改成INT128?如果是该怎么修改?
...全文

相关推荐

评论 5
收藏 已收藏
分享
返回顶部
qq_27778559
C# 111,129 成员 642,538 内容