[SNMP4J] Problem with ResponseListener timeout (SNMP4J 1.9.3d)
Frank Fock
fock at agentpp.com
Tue Apr 21 23:53:17 CEST 2009
Hi Marcin,
I can confirm that SNMP4J 1.9.3d does not
call onResponse with a null response PDU
when there was a response != null before
on the same request.
Whether this is a bug or not is questionable
but I agree that having such a call can
simplify async listener programming and is
therefore desirable. I will try to restore
this functionality in 1.10.
Best regards,
Frank
Marcin Kokoszka wrote:
> I'm using SNMP4J v1.9.3d
> I'm not sure but probably I have found some error.
> I have a problem with ResponseListener and timeouts. I'm sending some
> request (broadcast address) to search SNMP devices through the network. With
> previous SNMP4J v1.8.1 everything was and there was ok -> timeout after few
> seconds and the message "end scan" was displayed but with new version of the
> SNMP4J it seems that something is wrong. I have waited for the message "end
> scan" but without any results. Do You have any idea?
>
> UdpAddress targetaddress = new UdpAddress("255.255.255.255"+"/161");
> CommunityTarget target = new CommunityTarget();
> target.setCommunity(new OctetString(communityStringGet));
> target.setVersion(SnmpConstants.version1);
> target.setAddress(targetaddress);
> target.setRetries(1);
> target.setTimeout(timeout);
>
> final PDU pdu = createPDU(target, PDU.GET);
>
> for(int i = 0; i < vbs.size(); i++)
> {
> pdu.add((VariableBinding)vbs.get(i));
> }
> // sending request
> ResponseListener listener = new ResponseListener()
> {
> public void onResponse(ResponseEvent event)
> {
> if(event.getResponse() != null)
> {
> System.out.println(event.getPeerAddress().toString());
> }
> else
> {
> System.out.println("end scan");
> snmp.cancel(pdu, this);
> }
> }
> };
>
> try
> {
> snmp.send(pdu, target, null, listener);
> }
> catch (Exception e)
> {
> e.printStackTrace();
> }
>
> Best regards
> Marcin Kokoszka
> _______________________________________________
> SNMP4J mailing list
> SNMP4J at agentpp.org
> http://lists.agentpp.org/mailman/listinfo/snmp4j
--
AGENT++
http://www.agentpp.com
http://www.snmp4j.com
http://www.mibexplorer.com
http://www.mibdesigner.com
More information about the SNMP4J
mailing list