Microchip
直播中

许青云

7年用户 172经验值
私信 关注
[问答]

SNMP错误

在HARMony 2.01b上的SNMPv2中,我注意到了以下问题:我有一个被声明为16位宽度的整数变量。如果该值只使用一个字节,但高于127,则将其解释为字节,当使用MIB浏览器轮询时,它变成负整数。如果它超过了一个字节限制,则显示为ok(如256被报告为256,但255被报告为-1)。

以上来自于百度翻译


      以下为原文

    I noticed the following problem on SNMPv2 on Harmony 2.01b:

I have an integer variable that is declared as a 16 bit width. If the value is using only one byte but is higher than 127, then it is interpreted as a byte and it turns to a negative integer when polling with a MIB browser. If it passes over the one byte limit, then it is shown ok (like 256 is reported as 256 but 255 is reported as -1).
If I switch back to my old library (it is 1.02 or closer) it works ok.

The variables are declared as Integer32 in MIB file.

Adrian

回帖(2)

张蕾

2019-5-20 09:30:42
难道他们不被宣布为“未签名”吗?最佳选择

以上来自于百度翻译


      以下为原文

    Hi

Shouldn't they be declared as beeing "unsigned"?
 
 
Best regards
Jorge
举报

高桂清

2019-5-20 09:50:44
这个问题与CPU的变量大小无关。既不涉及编译器问题,也与SNMP服务器严格相关。SNMP的变量从二进制表示转换为通过UDP连接发送的字符串。在这个转换的地方应该是问题。

以上来自于百度翻译


      以下为原文

    The problem is not related to CPU variable sizes. Neither to compiler issues.
It is strictly related to SNMP server. The variables for SNMP are converted from binary representation to strings that are sent over the UDP connection. Somewhere in this conversion should be the problem.
举报

更多回帖

发帖
×
20
完善资料,
赚取积分