[SNMP4J] snmp.inform question

Wayne T weeznat at hotmail.com
Thu Nov 29 02:06:53 CET 2012



The javadoc states the following for SNMP.inform(...)
Returns:the received response encapsulated in a ResponseEvent
    instance. To obtain the received response PDU call
    ResponseEvent.getResponse(). If the request timed out,
    that method will return null.
Throws:
java.io.IOException - if the inform request could not be send to the specified target.
The
 snmp.inform command always seems to return a resposeEvent with 
responseEvent.getResponse() == null.  It doesn't matter if I send to a 
IP Address that does not exist in the network, or on a port that is not 
listened on.  It also does not throw IOException.  

In fact, when
 I send an inform PDU using SnmpRequest with args "-v 2c -p INFORM", the
 following code is called but the response is always set to null.
      long startTime = System.nanoTime();
      responseEvent = snmp.send(request, target);
      if (responseEvent != null) {
        response = responseEvent.getResponse();
        System.out.println("Received response after "+
                           (System.nanoTime()-startTime)/1000000+" milliseconds");
      }


In what case does inform throw an IOException?

Is there something that needs to be initialized so that responseEvent.getResponse() will return something other than null?

Thanks,

Wayne. 		 	   		  


More information about the SNMP4J mailing list