什么是针对SNMP的snmp4j lib中的Target

时间:2013-03-20 07:32:24

标签: windows networking snmp mib snmp4j

大家好!                     我有一个示例代码,用于在SNMP协议中使用snmp4j访问设备的某些信息...在示例代码中,他们已经将检索到的信息转储到某个目标地址,而我没有得到什么目标地址...

以下是我的代码......

 /**
 * This method returns a Target, which contains information about where the
 * data should be fetched and how.
 *
 * @return
 */
private Target getTarget() {
    Address targetAddress = GenericAddress.parse(address);
    CommunityTarget target = new CommunityTarget();
    target.setCommunity(new OctetString("public"));
    target.setAddress(targetAddress);
    target.setRetries(2);
    target.setTimeout(1500);
    target.setVersion(SnmpConstants.version2c);
    return target;
}

}

此方法已被 ResponseEvent 获取方法调用返回类型...

1 个答案:

答案 0 :(得分:0)

这只是您要从中检索某些SNMP信息的设备的IP地址。您可以像"udp:127.0.0.1/161"

一样编写它

Here is an example of a simple SNMP Client with snmp4j