[SNMP4J] Response is null, Why?
Frank Fock
fock at agentpp.com
Thu Nov 9 10:50:35 CET 2006
Hi Shuji,
Snmp.listen() is missing.
Best regards,
Frank
Shuji Urano wrote:
> 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
> _______________________________________________
> SNMP4J mailing list
> SNMP4J at agentpp.org
> http://lists.agentpp.org/mailman/listinfo/snmp4j
--
AGENT++
http://www.agentpp.com
http://www.mibexplorer.com
http://www.mibdesigner.com
More information about the SNMP4J
mailing list