[SNMP4J] Response is null, Why?
Shuji Urano
shuji.urano.dz at hitachi.com
Thu Nov 9 10:42:57 CET 2006
Hi there:
I am new in SNMP4j.
Now I want to get a information via SNMP4j as follows.
try
{
Snmp snmp = new Snmp("public");
Address targetAddress = GenericAddress.parse("udp:192.168.100.5/161");
CommunityTarget target = new CommunityTarget(targetAddress, new
OctetString("public"));
target.setVersion(SnmpConstants.version2c);
target.setRetries(2);
target.setTimeout(1500);
PDU pdu = new PDU();
pdu.add(new VariableBinding(new OID("1.3.6.1.2.1.2.2.1.10")));
pdu.setType(PDU.GET);
ResponseEvent responseEvent = snmp.get(pdu, target);
if (responseEvent.getResponse() == null) // I
need a information, but it returns null
System.err.println("TIME OUT");
// extract the response PDU (could be null if timed out)
PDU responsePDU = responseEvent.getResponse();
}
catch (Exception ex)
{
System.err.println(ex.getMessage());
}
Please show me where is wrong.
Shuji
More information about the SNMP4J
mailing list