[SNMP4J] An asynchronous SNMPv1 request
Vijay majagaonkar
vijaymajagaonkar at gmail.com
Mon Jul 14 14:07:37 CEST 2008
hello ppl,
some body can tell me how An asynchronous SNMPv1 request works, i m
getting confused , as the doc say that when i used this thing it
returns me the void so how do i get response .
[code]
// setting up target
CommunityTarget target = new CommunityTarget();
target.setCommunity(new OctetString("public"));
target.setAddress(targetAddress);
target.setRetries(2);
target.setTimeout(1500);
target.setVersion(SnmpConstants.version1);
// creating PDU
PDU pdu = new PDU();
pdu.add(new VariableBinding(new OID(new int[] {1.3.6.1.2.1.1.5.0})));
pdu.setType(PDU.GETNEXT);
// sending request
ResponseListener listener = new ResponseListener() {
public void onResponse(ResponseEvent event) {
// Always cancel async request when response has been received
// otherwise a memory leak is created! Not canceling a request
// immediately can be useful when sending a request to a broadcast
// address.
((Snmp)event.getSource()).cancel(event.getRequest(), this);
System.out.println("Received response PDU is: "+event.getResponse());
}
};
snmp.sendPDU(pdu, target, null, listener);
[/code]
here is the example from the doc in snmp4j some body plz tell me how
do i handell this thing,
Thanks
VM
--
"Human Knowledge Belongs To World"
More information about the SNMP4J
mailing list