[SNMP4J] SNMP4J v2 Inform - No acknowledgment received
George Vasilakis
george.vasilakis at gmail.com
Wed May 4 10:18:22 CEST 2011
Hi.
I am new to snmp4j and have implemented a simple trap receiver using
code from the examples.
I am using v2c informs but no acknowledgments are being received.
Here is the code for the receiver:
threadPool = ThreadPool.create("Trap", 10);
dispatcher = new MultiThreadedMessageDispatcher(threadPool,
new MessageDispatcherImpl());
listenAddress =
GenericAddress.parse(System.getProperty("snmp4j.listenAddress",
"udp:127.0.0.1/8080"));
snmp = new Snmp(dispatcher);
snmp.getMessageDispatcher().addMessageProcessingModel(new
MPv1());
snmp.getMessageDispatcher().addMessageProcessingModel(new
MPv2c());
snmp.addNotificationListener(listenAddress, this);
snmp.listen();
Here is the code for the sender:
Address targetAddress = GenericAddress.parse("udp:127.0.0.1/8080");
TransportMapping transport = new DefaultUdpTransportMapping();
Snmp snmp = new Snmp(transport);
CommunityTarget target = new CommunityTarget();
target.setVersion(SnmpConstants.version2c);
target.setAddress(targetAddress);
target.setCommunity(new OctetString("public"));
target.setRetries(1);
target.setTimeout(5000);
transport.listen();
PDU pdu = new PDU();
pdu.setType(PDU.INFORM);
pdu.add(new VariableBinding(SnmpConstants.sysUpTime, new
TimeTicks(111)));
pdu.add(new VariableBinding(SnmpConstants.snmpTrapOID, new
OID("1.3.6.1.3.65398.3.1")));
//Retrieve bindings from a database and add them to the pdu...
ResponseEvent response = snmp.inform(pdu, target);
PDU pduResponse = response.getResponse();
System.out.println("PDU response: " + pduResponse);
The receiver receives the informs and I am able to process them
normally, however no acknowledgments are sent back.
I would very much appreciate any help.
Thanks.
George
More information about the SNMP4J
mailing list