[SNMP4J] How to send synchronous SNMP GET response?

Ivan Mladenović piffta at gmail.com
Thu Apr 8 11:50:59 CEST 2010


Hello,

Could somebody give me some example how to send GET request, by using
SNMP4J?

I try following things:

ResponseEvent response = snmp.send(pdu, target);

and

ResponseListener listener = *new* ResponseListener() {

*    *@Override

*    public* *void* onResponse(ResponseEvent event) {

*     * PDU response = event.getResponse();

    }

};



listener.onResponse(session.send(pdu, target));



Also, I try all examples from book “Essential SNMP, 2nd Edition“, and all
examples I was found on the internet.

But, every time I get same result. I get the response event, but response
PDU is always null. When I try this by MIB browser it is working properly.

It looks like when I send request  my application does not wait to get
proper response.


Could anyone give me some example of how to send SNMP GET request by using
SNMP4J library?

Or, could anyone recommend some SNMP books about this?

Thanks in advance.



Ivan


2010/4/7 Ivan Mladenović <piffta at gmail.com>

> I’m using specific OID (for example, 1.3.6.1.4.1.1.3.0). That OID is
> defined in MIB file (used MIB file is specific for application).
>
> I have implemented command responder that should send me response. This
> working when I try to get value of this OID from MIB browser application.
>
>
> 2010/4/7 Rafał Krupiński <r.krupinski at gmail.com>
>
> 2010/4/7 Ivan Mladenović <piffta at gmail.com>:
>>
>> > pdu.add(*new* VariableBinding(new OID(new int[] {1,3,6,7}));
>>
>> Is 1.3.6.7 a specific variable or some subtree? with GET you need to
>> provide OID of a variable, like 1.3.6.1.2.1.1.1.0
>>
>> You could also use a sniffer, like wireshark and see what's sent over
>> the "wire".
>>
>> --
>> Pozdrawiam / Best Regards
>> Rafal Krupinski
>>
>
>



More information about the SNMP4J mailing list